-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeader.js
More file actions
53 lines (43 loc) · 1.41 KB
/
Header.js
File metadata and controls
53 lines (43 loc) · 1.41 KB
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
import React, { Component } from 'react';
import { withStyles, IconButton, Typography, Toolbar, AppBar } from '@material-ui/core'
import {
ArrowBack as ArrowBackIcon,
} from '@material-ui/icons'
const styles = {
root: {
// paddingTop: 64
},
flex: {
flex: 1,
},
menuButtonWrapper: {
marginLeft: -12,
marginRight: 20,
},
}
class Header extends Component {
goBack = () => window.history.back()
render() {
const { children, classes, title, backButton = false, rightAction, appBarProps, ...props } = this.props
return (
<AppBar position="sticky" {...appBarProps} {...props}>
<Toolbar>
<div className={classes.menuButtonWrapper}>
{backButton &&
<IconButton color="inherit" aria-label="Menu" onClick={this.goBack}>
<ArrowBackIcon />
</IconButton>}
</div>
{title &&
<Typography variant="title" color="inherit" className={classes.flex}>
{title}
</Typography>
}
{rightAction && <div>{rightAction}</div>}
</Toolbar>
{children}
</AppBar>
)
}
}
export default withStyles(styles)(Header);