2022-11-21 21:56:51 +00:00
|
|
|
import Accordion from "@mui/material/Accordion";
|
|
|
|
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
|
|
import AccordionDetails from "@mui/material/AccordionDetails";
|
2022-11-25 18:52:46 +00:00
|
|
|
import { Typography, useMediaQuery, useTheme } from "@mui/material";
|
2022-11-21 21:56:51 +00:00
|
|
|
import ExpandIcon from "./ExpandIcon";
|
|
|
|
import { useState } from "react";
|
|
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
content: [string, string][];
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function AccordionWrapper({ content }: Props) {
|
2022-11-24 18:08:51 +00:00
|
|
|
const theme = useTheme();
|
2022-11-25 18:52:46 +00:00
|
|
|
const upMd = useMediaQuery(theme.breakpoints.up("md"));
|
2022-11-21 21:56:51 +00:00
|
|
|
const [expandedId, setExpandedId] = useState<number | null>(null);
|
|
|
|
|
|
|
|
const handleChange = (panelId: number) => (event: React.SyntheticEvent, newExpanded: boolean) => {
|
|
|
|
setExpandedId(newExpanded ? panelId : null);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{content.map((accordionItem, index) => (
|
|
|
|
<Accordion
|
|
|
|
expanded={expandedId === index}
|
|
|
|
onChange={handleChange(index)}
|
|
|
|
disableGutters
|
|
|
|
key={index}
|
|
|
|
sx={{
|
2022-11-25 18:52:46 +00:00
|
|
|
boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24),
|
|
|
|
0px 41.7776px 129.093px rgba(210, 208, 225, 0.172525),
|
|
|
|
0px 22.3363px 69.0192px rgba(210, 208, 225, 0.143066),
|
|
|
|
0px 12.5216px 38.6916px rgba(210, 208, 225, 0.12),
|
|
|
|
0px 6.6501px 20.5488px rgba(210, 208, 225, 0.0969343),
|
|
|
|
0px 2.76726px 8.55082px rgba(210, 208, 225, 0.0674749)`,
|
2022-11-21 21:56:51 +00:00
|
|
|
"&.MuiAccordion-rounded:first-of-type": {
|
|
|
|
borderTopLeftRadius: "12px",
|
|
|
|
borderTopRightRadius: "12px",
|
|
|
|
},
|
|
|
|
"&.MuiAccordion-rounded:last-of-type": {
|
|
|
|
borderBottomLeftRadius: "12px",
|
|
|
|
borderBottomRightRadius: "12px",
|
|
|
|
},
|
|
|
|
"&.MuiAccordion-root:before": {
|
2022-11-24 19:22:30 +00:00
|
|
|
backgroundColor: theme.palette.grey2.main,
|
2022-11-21 21:56:51 +00:00
|
|
|
opacity: 1,
|
|
|
|
}
|
|
|
|
}}>
|
|
|
|
<AccordionSummary
|
|
|
|
expandIcon={<ExpandIcon isExpanded={expandedId === index} />}
|
|
|
|
sx={{
|
|
|
|
height: "72px",
|
|
|
|
px: "20px",
|
2022-11-25 18:52:46 +00:00
|
|
|
pt: upMd ? "29px" : "26px",
|
|
|
|
pb: upMd ? "21px" : "20px",
|
2022-11-21 21:56:51 +00:00
|
|
|
}}
|
|
|
|
>
|
2022-11-25 18:52:46 +00:00
|
|
|
<Typography
|
|
|
|
sx={{
|
|
|
|
fontSize: upMd ? undefined : "16px",
|
|
|
|
lineHeight: upMd ? undefined : "19px",
|
|
|
|
fontWeight: 500,
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
px: 0,
|
|
|
|
}}
|
|
|
|
>{accordionItem[0]}</Typography>
|
2022-11-21 21:56:51 +00:00
|
|
|
</AccordionSummary>
|
2022-11-25 18:52:46 +00:00
|
|
|
<AccordionDetails
|
|
|
|
sx={{
|
|
|
|
px: "20px",
|
|
|
|
py: upMd ? "25px" : undefined,
|
|
|
|
pt: upMd ? undefined : "15px",
|
|
|
|
pb: upMd ? undefined : "25px",
|
|
|
|
backgroundColor: "#F1F2F6"
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Typography
|
|
|
|
sx={{
|
|
|
|
fontSize: upMd ? undefined : "16px",
|
|
|
|
lineHeight: upMd ? undefined : "19px",
|
|
|
|
color: theme.palette.grey3.main,
|
|
|
|
}}
|
|
|
|
>{accordionItem[1]}</Typography>
|
2022-11-21 21:56:51 +00:00
|
|
|
</AccordionDetails>
|
|
|
|
</Accordion>
|
|
|
|
))}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|