import classNames from 'classnames'; import { IListOwnProps, } from './IListOwnProps'; import MuiList from '@material-ui/core/List'; import MuiListSubheader from '@material-ui/core/ListSubheader'; import * as React from 'react'; export const List: React.FunctionComponent = ({ children, className, component, dontWrapInListItem, listItemProps, subheader, subheaderProps, ...props }) => ( {subheader ? {subheader} : null} {React.Children.toArray(children).map((child, key) => { if (component) { return React.createElement( component, { key, ...listItemProps, }, child, ); } else if (React.isValidElement(child)) { return React.cloneElement( child, { key, ...listItemProps, }, ); } return child; })} );