Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 12x 12x | import React from 'react'; import * as R from 'ramda'; import cx from 'classnames'; import PropTypes from 'prop-types'; import ExpansionPanel from '@material-ui/core/ExpansionPanel'; import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'; import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'; import Typography from '@material-ui/core/Typography'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { useStyles } from './styles'; import { withBlank } from '../utils'; const CustomExpansionPanel = ({ id, topElementComponent, onChangeActivePanel, label, tag, overflow, children, isOpen, }) => { const classes = useStyles(); return ( <ExpansionPanel expanded={isOpen} onChange={R.is(Function)(onChangeActivePanel) ? () => onChangeActivePanel(id) : undefined} classes={{ root: classes.panel }} elevation={0} > <ExpansionPanelSummary className={classes.container} classes={{ content: classes.content, expandIcon: classes.iconSummaryPanel }} expandIcon={<ExpandMoreIcon />} > <Typography noWrap className={classes.content} title={label}> {label} </Typography> {R.isNil(tag) ? null : tag} </ExpansionPanelSummary> {R.isNil(topElementComponent) ? null : topElementComponent} <ExpansionPanelDetails className={cx(classes.details, { [classes.overflow]: overflow })}> {children} </ExpansionPanelDetails> </ExpansionPanel> ); }; CustomExpansionPanel.propTypes = { id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), classes: PropTypes.object, topElementComponent: PropTypes.element, onChangeActivePanel: PropTypes.func, label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), tag: PropTypes.element, overflow: PropTypes.bool, isOpen: PropTypes.bool, isBlank: PropTypes.bool, children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]), }; export default withBlank(({ isBlank }) => ({ isBlank }))(CustomExpansionPanel); |