Skip to content

Commit cf6a8b1

Browse files
author
Bart Hazen
committed
Implement base design.
1 parent e790d89 commit cf6a8b1

File tree

7 files changed

+318
-52
lines changed

7 files changed

+318
-52
lines changed

src/components/Header/index.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import AppBar from '@material-ui/core/AppBar';
4+
import Grid from '@material-ui/core/Grid';
5+
import Hidden from '@material-ui/core/Hidden';
6+
import IconButton from '@material-ui/core/IconButton';
7+
import MenuIcon from '@material-ui/icons/Menu';
8+
import Toolbar from '@material-ui/core/Toolbar';
9+
import Typography from '@material-ui/core/Typography';
10+
import { withStyles } from '@material-ui/core/styles';
11+
12+
const lightColor = 'rgba(255, 255, 255, 0.7)';
13+
14+
const styles = (theme) => ({
15+
secondaryBar: {
16+
zIndex: 0,
17+
},
18+
menuButton: {
19+
marginLeft: -theme.spacing(1),
20+
},
21+
iconButtonAvatar: {
22+
padding: 4,
23+
},
24+
link: {
25+
textDecoration: 'none',
26+
color: lightColor,
27+
'&:hover': {
28+
color: theme.palette.common.white,
29+
},
30+
},
31+
button: {
32+
borderColor: lightColor,
33+
},
34+
});
35+
36+
function Header(props) {
37+
const { classes, title, onDrawerToggle } = props;
38+
39+
return (
40+
<React.Fragment>
41+
<AppBar color="primary" position="sticky" elevation={0}>
42+
<Toolbar>
43+
<Grid container spacing={1} alignItems="center">
44+
<Hidden smUp>
45+
<Grid item>
46+
<IconButton
47+
color="inherit"
48+
aria-label="open drawer"
49+
onClick={onDrawerToggle}
50+
className={classes.menuButton}
51+
>
52+
<MenuIcon />
53+
</IconButton>
54+
</Grid>
55+
</Hidden>
56+
</Grid>
57+
</Toolbar>
58+
</AppBar>
59+
<AppBar
60+
component="div"
61+
className={classes.secondaryBar}
62+
color="primary"
63+
position="static"
64+
elevation={0}
65+
>
66+
<Toolbar>
67+
<Grid container alignItems="center" spacing={1}>
68+
<Grid item xs>
69+
<Typography color="inherit" variant="h5" component="h1">{title}</Typography>
70+
</Grid>
71+
</Grid>
72+
</Toolbar>
73+
</AppBar>
74+
</React.Fragment>
75+
);
76+
}
77+
78+
Header.propTypes = {
79+
classes: PropTypes.object.isRequired,
80+
title: PropTypes.string.isRequired,
81+
onDrawerToggle: PropTypes.func.isRequired,
82+
};
83+
84+
export default withStyles(styles)(Header);

src/index.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,9 @@ import ReactDOM from 'react-dom';
44
import './index.scss';
55
import App from './App';
66

7-
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
8-
9-
const theme = createMuiTheme({
10-
palette: {
11-
type: 'dark',
12-
},
13-
});
14-
157
ReactDOM.render(
16-
<MuiThemeProvider theme={theme}>
17-
<React.StrictMode>
18-
<App />
19-
</React.StrictMode>
20-
</MuiThemeProvider>,
8+
<React.StrictMode>
9+
<App />
10+
</React.StrictMode>,
2111
document.getElementById('root')
2212
);

src/pages/Homepage/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import React from 'react';
2+
import Header from '../../components/Header';
23

34
import './style.scss';
45

5-
export default function Homepage(props) {
6+
export default class Homepage extends React.Component {
7+
render() {
68
return (
7-
<>
8-
Homepage
9-
</>
9+
<React.Fragment>
10+
<Header
11+
onDrawerToggle={this.props.handleDrawerToggle}
12+
title="Python Create"
13+
/>
14+
15+
<main className={this.props.classes.main}>
16+
Homepage.
17+
</main>
18+
</React.Fragment>
1019
);
20+
}
1121
}

src/pages/SetupPy/index.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import React from 'react';
2+
import Header from '../../components/Header';
23

34
import './style.scss';
45

5-
export default function SetupPy(props) {
6-
return (
7-
<>
8-
Setup.py
9-
</>
10-
);
6+
export default class SetupPy extends React.Component {
7+
render() {
8+
return (
9+
<React.Fragment>
10+
<Header
11+
onDrawerToggle={this.props.handleDrawerToggle}
12+
title="setup.py generator"
13+
/>
14+
15+
<main className={this.props.classes.main}>
16+
Setup.py generator.
17+
</main>
18+
</React.Fragment>
19+
);
20+
}
1121
}

src/routes/RouteWithScene.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ const RouteWithScene = props => {
99
<Route
1010
{...rest}
1111
render={matchProps => (
12-
<Scene>
13-
<Component {...matchProps} />
14-
</Scene>
12+
<Scene component={Component} {...matchProps} />
1513
)}
1614
/>
1715
);
@@ -20,7 +18,7 @@ const RouteWithScene = props => {
2018
RouteWithScene.propTypes = {
2119
component: PropTypes.any.isRequired,
2220
scene: PropTypes.any.isRequired,
23-
path: PropTypes.string
21+
path: PropTypes.string,
2422
};
2523

2624
export default RouteWithScene;

src/routes/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import React from "react";
22
import { Switch, Redirect } from "react-router-dom";
33

4-
import Main from "../scenes/Main"
4+
import Paperbase from "../scenes/Main"
55
import SetupPy from "../pages/SetupPy"
66
import Homepage from "../pages/Homepage"
77
import RouteWithScene from "./RouteWithScene";
88

99
export default function Routes() {
1010
return (
1111
<Switch>
12-
<RouteWithScene path="/setup-py-generator" component={SetupPy} scene={Main} />
13-
<RouteWithScene path="/" component={Homepage} scene={Main} />
12+
<RouteWithScene path="/setup-py-generator" scene={Paperbase} component={SetupPy} />
13+
<RouteWithScene path="/" scene={Paperbase} component={Homepage} />
1414
<Redirect to="/" />
1515
</Switch>
1616
);

0 commit comments

Comments
 (0)