bbgo_origin/frontend/pages/_app.tsx

107 lines
2.9 KiB
TypeScript
Raw Normal View History

2021-01-24 06:32:52 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import Head from 'next/head';
2021-01-24 10:12:26 +00:00
import {makeStyles, ThemeProvider} from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
2021-01-29 17:04:32 +00:00
import SideBar from '../components/SideBar';
2021-01-24 06:32:52 +00:00
2021-01-24 10:12:26 +00:00
import CssBaseline from '@material-ui/core/CssBaseline';
2021-01-24 06:32:52 +00:00
import theme from '../src/theme';
2021-01-24 06:07:44 +00:00
import '../styles/globals.css'
2021-01-24 10:12:26 +00:00
const drawerWidth = 240;
const useStyles = makeStyles((theme) => ({
root: {
// flexGrow: 1,
display: 'flex',
},
content: {
flexGrow: 1,
height: '100vh',
overflow: 'auto',
},
fixedHeight: {
height: 240,
},
toolbar: {
paddingRight: 24, // keep right padding when drawer closed
},
toolbarIcon: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: '0 8px',
...theme.mixins.toolbar,
},
menuButton: {
marginRight: 36,
},
menuButtonHidden: {
display: 'none',
},
title: {
flexGrow: 1,
},
appBar: {
zIndex: theme.zIndex.drawer + 1,
},
appBarSpacer: theme.mixins.toolbar,
}));
2021-01-24 06:32:52 +00:00
export default function MyApp(props) {
2021-01-24 10:12:26 +00:00
const {Component, pageProps} = props;
const classes = useStyles();
React.useEffect(() => {
// Remove the server-side injected CSS.
const jssStyles = document.querySelector('#jss-server-side');
if (jssStyles) {
jssStyles.parentElement.removeChild(jssStyles);
}
}, []);
return (
<React.Fragment>
<Head>
<title>BBGO</title>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width"/>
</Head>
<ThemeProvider theme={theme}>
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline/>
2021-01-29 17:04:32 +00:00
<div className={classes.root}>
<AppBar className={classes.appBar}>
2021-01-24 10:12:26 +00:00
<Toolbar>
<Typography variant="h6" className={classes.title}>
BBGO
</Typography>
<Button color="inherit">Login</Button>
</Toolbar>
</AppBar>
2021-01-29 17:04:32 +00:00
<SideBar/>
2021-01-24 10:12:26 +00:00
<main className={classes.content}>
<div className={classes.appBarSpacer}/>
<Component {...pageProps} />
</main>
</div>
</ThemeProvider>
</React.Fragment>
);
2021-01-24 06:07:44 +00:00
}
2021-01-24 06:32:52 +00:00
MyApp.propTypes = {
2021-01-24 10:12:26 +00:00
Component: PropTypes.elementType.isRequired,
pageProps: PropTypes.object.isRequired,
2021-01-24 06:32:52 +00:00
};