UNPKG

react-garden

Version:

React + TypeScript + ThreeJS app using Material UI on NextJS, Apollo Client, GraphQL + WordPress REST APIs, for ThreeD web development.. a part of the threed.ai code family.

127 lines (115 loc) 4.2 kB
// ** React Imports import { useState } from 'react' // ** MUI Imports import { styled } from '@mui/material/styles' import Typography from '@mui/material/Typography' import MuiAccordion from '@mui/material/Accordion' import MuiAccordionSummary from '@mui/material/AccordionSummary' import MuiAccordionDetails from '@mui/material/AccordionDetails' // ** Icons Imports import Plus from 'mdi-material-ui/Plus' import Minus from 'mdi-material-ui/Minus' // Styled component for Accordion component const Accordion = styled(MuiAccordion)(({ theme }) => ({ boxShadow: 'none !important', border: theme.palette.mode === 'light' ? `1px solid ${theme.palette.grey[300]}` : `1px solid ${theme.palette.divider}`, '&:not(:last-of-type)': { borderBottom: 0 }, '&:before': { display: 'none' }, '&.Mui-expanded': { margin: 'auto' }, '&:first-of-type': { '& .MuiButtonBase-root': { borderTopLeftRadius: theme.shape.borderRadius, borderTopRightRadius: theme.shape.borderRadius } }, '&:last-of-type': { '& .MuiAccordionSummary-root:not(.Mui-expanded)': { borderBottomLeftRadius: theme.shape.borderRadius, borderBottomRightRadius: theme.shape.borderRadius } } })) // Styled component for AccordionSummary component const AccordionSummary = styled(MuiAccordionSummary)(({ theme }) => ({ marginBottom: -1, padding: theme.spacing(0, 4), minHeight: theme.spacing(12), backgroundColor: theme.palette.mode === 'light' ? theme.palette.grey[50] : theme.palette.background.default, borderBottom: theme.palette.mode === 'light' ? `1px solid ${theme.palette.grey[300]}` : `1px solid ${theme.palette.divider}`, '&.Mui-expanded': { minHeight: theme.spacing(12) }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' } })) // Styled component for AccordionDetails component const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({ padding: `${theme.spacing(4)} !important` })) const AccordionCustomized = () => { // ** State const [expanded, setExpanded] = useState('panel1') const handleChange = panel => (event, isExpanded) => { setExpanded(isExpanded ? panel : false) } const expandIcon = value => (expanded === value ? <Minus /> : <Plus />) return ( <div> <Accordion expanded={expanded === 'panel1'} onChange={handleChange('panel1')}> <AccordionSummary id='customized-panel-header-1' expandIcon={expandIcon('panel1')} aria-controls='customized-panel-content-1' > <Typography>Accordion 1</Typography> </AccordionSummary> <AccordionDetails> <Typography> Wafer sesame snaps chocolate bar candy canes halvah. Cupcake sesame snaps sweet tart dessert biscuit. Topping soufflé tart sweet croissant. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel2'} onChange={handleChange('panel2')}> <AccordionSummary id='customized-panel-header-2' expandIcon={expandIcon('panel2')} aria-controls='customized-panel-content-2' > <Typography>Accordion 2</Typography> </AccordionSummary> <AccordionDetails> <Typography> Sugar plum sesame snaps caramels. Cake pie tart fruitcake sesame snaps donut cupcake macaroon. Gingerbread pudding cheesecake pie ice cream. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel3'} onChange={handleChange('panel3')}> <AccordionSummary id='customized-panel-header-3' expandIcon={expandIcon('panel3')} aria-controls='customized-panel-content-3' > <Typography>Accordion 3</Typography> </AccordionSummary> <AccordionDetails> <Typography> Gingerbread lemon drops bear claw gummi bears bonbon wafer jujubes tiramisu. Jelly pie cake. Sweet roll dessert sweet pastry powder. </Typography> </AccordionDetails> </Accordion> </div> ) } export default AccordionCustomized