ExpansionPanel >>> Accordion

master
Tudor Stanciu 2021-05-16 02:01:05 +03:00
parent f0817c30e5
commit f75afd268f
2 changed files with 21 additions and 24 deletions

View File

@ -1,9 +1,9 @@
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import {
ExpansionPanel,
ExpansionPanelSummary,
ExpansionPanelDetails
Accordion,
AccordionSummary,
AccordionDetails
} from "@material-ui/core";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import PropTypes from "prop-types";
@ -23,7 +23,7 @@ const ReleaseNotesListComponent = ({
const classes = useStyles();
const { t } = useTranslation();
const getCollapsed = (version) => {
const getCollapsed = version => {
const flag = notesFlags[version];
const collapsed = !flag || flag === false;
return collapsed;
@ -36,13 +36,10 @@ const ReleaseNotesListComponent = ({
<Spinner />
) : (
releaseNotes.loaded &&
releaseNotes.map((note) => {
releaseNotes.map(note => {
return (
<ExpansionPanel
key={note.version}
onChange={handleToggle(note.version)}
>
<ExpansionPanelSummary
<Accordion key={note.version} onChange={handleToggle(note.version)}>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
id={`panel-${note.version}-header`}
>
@ -50,11 +47,11 @@ const ReleaseNotesListComponent = ({
releaseNote={note}
collapsed={getCollapsed(note.version)}
/>
</ExpansionPanelSummary>
<ExpansionPanelDetails>
</AccordionSummary>
<AccordionDetails>
<ReleaseNotesComponent releaseNote={note} />
</ExpansionPanelDetails>
</ExpansionPanel>
</AccordionDetails>
</Accordion>
);
})
)}

View File

@ -1,9 +1,9 @@
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import {
ExpansionPanel,
ExpansionPanelSummary,
ExpansionPanelDetails
Accordion,
AccordionSummary,
AccordionDetails
} from "@material-ui/core";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import PropTypes from "prop-types";
@ -31,28 +31,28 @@ const SessionListComponent = ({
<Spinner />
) : (
sessions.loaded &&
sessions.map((session) => {
sessions.map(session => {
return (
<ExpansionPanel
<Accordion
key={session.sessionId}
onChange={handleToggle(session.sessionId)}
>
<ExpansionPanelSummary
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls={`panel-${session.sessionId}-content`}
id={`panel-${session.sessionId}-header`}
>
<SessionSummary session={session} />
</ExpansionPanelSummary>
<ExpansionPanelDetails>
</AccordionSummary>
<AccordionDetails>
<SessionForwardsComponent
session={session}
forwards={forwards[session.sessionId]}
openOptionsDialog={openOptionsDialog}
showSessionInfo={true}
/>
</ExpansionPanelDetails>
</ExpansionPanel>
</AccordionDetails>
</Accordion>
);
})
)}