import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import classNames from 'classnames'; import MenuIcon from '@material-ui/icons/Menu'; import { Drawer, AppBar, Toolbar, List, Typography, Divider, IconButton, Hidden } from '@material-ui/core'; import { mailFolderListItems, otherMailFolderListItems } from './menuData'; const drawerWidth = 240; const styles = theme => ({ root: { flexGrow: 1, height: 430, zIndex: 1, overflow: 'hidden', position: 'relative', display: 'flex', }, appBar: { zIndex: theme.zIndex.drawer + 1, transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), }, appBarShift: { marginLeft: 0, width: '100%', transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, }), [theme.breakpoints.up('md')]: { marginLeft: drawerWidth, width: `calc(100% - ${drawerWidth}px)`, }, }, menuButton: { marginLeft: 0, marginRight: 36, }, drawerPaper: { width: drawerWidth, transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, }), [theme.breakpoints.up('md')]: { position: 'relative', }, }, drawerPaperClose: { overflowX: 'hidden', transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), width: 70, [theme.breakpoints.up('sm')]: { width: 70, }, }, toolbar: { display: 'flex', alignItems: 'center', justifyContent: 'flex-end', padding: '0 8px', ...theme.mixins.toolbar, }, content: { flexGrow: 1, backgroundColor: theme.palette.background.default, padding: theme.spacing(3), }, }); class SidebarLayout extends React.Component { state = { open: true, }; componentDidMount() { window.addEventListener('resize', this.resize.bind(this)); this.resize(); } resize() { this.setState({ open: window.innerWidth >= 760 }); } handleDrawerToggle = () => { this.setState({ open: !this.state.open }); }; render() { const { classes } = this.props; const { open } = this.state; const drawer = (