// tslint:disable:no-magic-numbers import { List, ListItem, ListItemText } from '@material-ui/core'; import MuiExpansionPanel from '@material-ui/core/ExpansionPanel'; import MuiExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'; import MuiExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'; import { withStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import ExpandLessIcon from '@material-ui/icons/ExpandLess'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import PlayCircleOutlineIcon from '@material-ui/icons/PlayCircleOutline'; import React from 'react'; import Section from '../../types/items/Section'; const ExpansionPanel = withStyles({ root: { '&$expanded': { margin: 'auto', }, '&:before': { display: 'none', }, '&:not(:last-child)': { margin: '12px 0', }, border: '1px solid rgba(0, 0, 0, .125)', expanded: {}, }, })(MuiExpansionPanel); const ExpansionPanelSummary = withStyles({ content: { margin: '12px 0', }, expanded: {}, root: { '&$expanded': { minHeight: 56, }, alignItems: 'center', backgroundColor: 'rgba(0, 0, 0, .03)', borderBottom: '1px solid rgba(0, 0, 0, .125)', display: 'flex', minHeight: 56, }, })(MuiExpansionPanelSummary); const ExpansionPanelDetails = withStyles(theme => ({ root: { padding: theme.spacing(1), }, }))(MuiExpansionPanelDetails); export interface Unit { readonly title: string; } interface Options { readonly section: Section; readonly expandedIds: string[]; readonly onChange: ( event: React.ChangeEvent<{}>, isExpanded: boolean ) => void; } const CourseSection = ({ section, expandedIds, onChange }: Options) => { const expanded = expandedIds.includes(section.id); return ( {expanded ? : } {section.title} {section.units.map((unit: Unit, index: number) => ( <> ))} ); }; // tslint:disable-next-line:max-file-line-count export default CourseSection;