diff --git a/src/features/releaseNotes/components/ReleaseNotesComponent.js b/src/features/releaseNotes/components/ReleaseNotesComponent.js new file mode 100644 index 0000000..b32a08a --- /dev/null +++ b/src/features/releaseNotes/components/ReleaseNotesComponent.js @@ -0,0 +1,27 @@ +import React from "react"; +import PropTypes from "prop-types"; +import Typography from "@material-ui/core/Typography"; + +const ReleaseNotesComponent = ({ releaseNote }) => { + return ( +
+ {releaseNote.notes.map((note) => { + return ( + + {note} + + ); + })} +
+ ); +}; + +ReleaseNotesComponent.propTypes = { + releaseNote: PropTypes.object.isRequired +}; + +export default ReleaseNotesComponent; diff --git a/src/features/releaseNotes/components/ReleaseNotesContainer.js b/src/features/releaseNotes/components/ReleaseNotesContainer.js index 0994868..3ac6538 100644 --- a/src/features/releaseNotes/components/ReleaseNotesContainer.js +++ b/src/features/releaseNotes/components/ReleaseNotesContainer.js @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React, { useEffect, useState } from "react"; import { connect } from "react-redux"; import { bindActionCreators } from "redux"; import PropTypes from "prop-types"; @@ -6,11 +6,26 @@ import { loadReleaseNotes } from "../actionCreators"; import ReleaseNotesListComponent from "./ReleaseNotesListComponent"; const ReleaseNotesContainer = ({ actions, releaseNotes }) => { + const [notesFlags, setNotesFlags] = useState({}); + useEffect(() => { actions.loadReleaseNotes(); }, []); - return ; + const handleToggle = (version) => (_, expanded) => { + setNotesFlags({ + ...notesFlags, + [version]: expanded + }); + }; + + return ( + + ); }; ReleaseNotesContainer.propTypes = { diff --git a/src/features/releaseNotes/components/ReleaseNotesListComponent.js b/src/features/releaseNotes/components/ReleaseNotesListComponent.js index 1f29d04..8847547 100644 --- a/src/features/releaseNotes/components/ReleaseNotesListComponent.js +++ b/src/features/releaseNotes/components/ReleaseNotesListComponent.js @@ -8,14 +8,25 @@ import PropTypes from "prop-types"; import Spinner from "../../../components/common/Spinner"; import { useTranslation } from "react-i18next"; import ReleaseNotesSummary from "./ReleaseNotesSummary"; +import ReleaseNotesComponent from "./ReleaseNotesComponent"; import styles from "../../../components/common/styles/divStyles"; const useStyles = makeStyles(styles); -const ReleaseNotesListComponent = ({ releaseNotes }) => { +const ReleaseNotesListComponent = ({ + releaseNotes, + handleToggle, + notesFlags +}) => { const classes = useStyles(); const { t } = useTranslation(); + const getCollapsed = (version) => { + const flag = notesFlags[version]; + const collapsed = !flag || flag === false; + return collapsed; + }; + return (

{t("ReleaseNotes.Title")}

@@ -25,15 +36,21 @@ const ReleaseNotesListComponent = ({ releaseNotes }) => { releaseNotes.loaded && releaseNotes.map((note) => { return ( - + } id={`panel-${note.version}-header`} > - + -
TO DO
+
); @@ -44,7 +61,9 @@ const ReleaseNotesListComponent = ({ releaseNotes }) => { }; ReleaseNotesListComponent.propTypes = { - releaseNotes: PropTypes.array.isRequired + releaseNotes: PropTypes.array.isRequired, + handleToggle: PropTypes.func.isRequired, + notesFlags: PropTypes.object.isRequired }; export default ReleaseNotesListComponent; diff --git a/src/features/releaseNotes/components/ReleaseNotesSummary.js b/src/features/releaseNotes/components/ReleaseNotesSummary.js index 0ee7087..cb83a94 100644 --- a/src/features/releaseNotes/components/ReleaseNotesSummary.js +++ b/src/features/releaseNotes/components/ReleaseNotesSummary.js @@ -4,30 +4,33 @@ import { Grid } from "@material-ui/core"; import { makeStyles } from "@material-ui/core/styles"; import { useTranslation } from "react-i18next"; import styles from "../../../components/common/styles/gridStyles"; +import Typography from "@material-ui/core/Typography"; const useStyles = makeStyles(styles); -const ReleaseNotesSummary = ({ releaseNote }) => { +const ReleaseNotesSummary = ({ releaseNote, collapsed }) => { const classes = useStyles(); const { t } = useTranslation(); return ( - - {`${t("ReleaseNotes.Version")}: `} - {releaseNote.version} - - - - {`${t("ReleaseNotes.Version")}: `} - {releaseNote.version} + + + {`${t("ReleaseNotes.Version")}: ${releaseNote.version}`} + + {collapsed && ( + + {releaseNote.notes[0]} + + )} ); }; ReleaseNotesSummary.propTypes = { - releaseNote: PropTypes.object.isRequired + releaseNote: PropTypes.object.isRequired, + collapsed: PropTypes.bool.isRequired }; export default ReleaseNotesSummary;