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 ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import { Drawer, AppBar, Toolbar, List, Typography, MenuItem, Divider, TextField, IconButton, } from '@material-ui/core'; import { mailFolderListItems, otherMailFolderListItems } from './menuData'; const drawerWidth = 240; const styles = theme => ({ root: { flexGrow: 1, }, appFrame: { height: 430, zIndex: 1, overflow: 'hidden', position: 'relative', display: 'flex', width: '100%', }, appBar: { zIndex: theme.zIndex.drawer + 1, padding: '0 24px', transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), }, appBarShift: { marginLeft: drawerWidth, width: `calc(100% - ${drawerWidth}px)`, transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, }), }, 'appBarShift-left': { marginLeft: drawerWidth, }, 'appBarShift-right': { marginRight: drawerWidth, }, menuButton: { marginLeft: 3, marginRight: 3, }, hide: { display: 'none', }, drawerPaper: { position: 'relative', whiteSpace: 'nowrap', width: drawerWidth, transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, }), }, drawerPaperClose: { overflowX: 'hidden', transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), width: theme.spacing(7), [theme.breakpoints.up('sm')]: { width: theme.spacing(9), }, }, 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), }, 'content-left': { marginLeft: -drawerWidth, }, 'content-right': { marginRight: -drawerWidth, }, contentShift: { transition: theme.transitions.create('margin', { easing: theme.transitions.easing.easeOut, duration: theme.transitions.duration.enteringScreen, }), }, 'contentShift-left': { marginLeft: 0, }, 'contentShift-right': { marginRight: 0, }, title: { flex: 1, } }); class MiniDrawer extends React.Component { state = { open: false, anchor: 'left', }; handleDrawerOpen = () => { this.setState({ open: true }); }; handleDrawerClose = () => { this.setState({ open: false }); }; handleChangeAnchor = event => { this.setState({ anchor: event.target.value, }); }; render() { const { classes, theme } = this.props; const { anchor, open } = this.state; const drawer = (
{theme.direction === 'rtl' ? : }
{mailFolderListItems} {otherMailFolderListItems}
); const menuBtn = ( ); let before = null; let after = null; let beforeBtn = null; let afterBtn = null; if (anchor === 'left') { before = drawer; beforeBtn = menuBtn; } else { after = drawer; afterBtn = menuBtn; } return (
left right
{beforeBtn} Mini variant drawer {afterBtn} {before}
{'You think water moves fast? You should see ice.'}
{after}
); } } MiniDrawer.propTypes = { classes: PropTypes.object.isRequired, theme: PropTypes.object.isRequired, }; export default withStyles(styles, { withTheme: true })(MiniDrawer);