File size: 2,863 Bytes
1e92f2d |
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
import React from 'react';
import PropTypes from 'prop-types';
import Head from 'next/head';
import Typography from '@mui/material/Typography';
import AppBar from '@mui/material/AppBar';
import Toolbar from '@mui/material/Toolbar';
import IconButton from '@mui/material/IconButton';
import MenuIcon from '@mui/icons-material/Menu';
import Tooltip from '@mui/material/Tooltip';
import GitHub from '../icons/GitHub';
import withRoot from '../utils/withRoot';
import { withStyles } from 'tss-react/mui';
import Menu from './Menu';
/* eslint-disable import/no-webpack-loader-syntax */
import lightTheme from '!raw-loader!prismjs/themes/prism.css';
const styles = theme => ({
appBar: {
backgroundColor: '#23232f',
},
toolBar: {
justifyContent: 'space-between',
},
logo: {
display: 'block',
height: '56px',
position: 'relative',
top: '5px',
},
wrapper: {
flex: '1 0 100%',
},
content: {
flex: '1 0 100%',
margin: '0 auto',
padding: '16px 16px 0px 16px',
marginTop: '64px',
minHeight: '600px',
maxWidth: '960px',
},
footer: {
flex: '1 0 100%',
marginTop: '32px',
},
});
class Layout extends React.Component {
state = {
drawerIsOpen: false,
};
componentDidMount() {
const styleNode = document.createElement('style');
styleNode.setAttribute('data-prism', 'true');
if (document.head) {
document.head.appendChild(styleNode);
}
styleNode.textContent = lightTheme;
}
toggleDrawer = () => {
const drawerIsOpen = this.state.drawerIsOpen ? false : true;
this.setState({ drawerIsOpen });
};
render() {
const { classes, children } = this.props;
const { drawerIsOpen } = this.state;
return (
<div className={classes.wrapper}>
<Menu isOpen={drawerIsOpen} toggle={this.toggleDrawer} />
<AppBar classes={{ root: classes.appBar }}>
<Toolbar classes={{ root: classes.toolBar }}>
<IconButton onClick={this.toggleDrawer} color="inherit" aria-label="open drawer">
<MenuIcon />
</IconButton>
<a href="/">
<img className={classes.logo} src="/static/header.png" alt="Home" border="0" />
</a>
<Tooltip id="appbar-github" title="Material-UI Datatables repo" enterDelay={300}>
<IconButton
component="a"
color="inherit"
href="https://github.com/gregnb/mui-datatables"
aria-labelledby="appbar-github">
<GitHub />
</IconButton>
</Tooltip>
</Toolbar>
</AppBar>
<main id="main-content" className={classes.content}>
{children}
</main>
<footer className={classes.footer} />
</div>
);
}
}
export default withRoot(withStyles(Layout, styles));
|