-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.js
62 lines (57 loc) · 1.69 KB
/
index.js
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
import React, { Component } from 'react';
import { AppBar, Toolbar, Button, withStyles, IconButton } from '@material-ui/core';
import MenuIcon from '@material-ui/icons/Menu'
import { auth as authUI} from '@openchemistry/girder-ui';
import AdminMenu from '../../containers/administrator/menu-item';
import JupyterMenu from '../../containers/jupyterlab-integration/menu-item';
import logo from '../../OpenChemistry_Logo.svg';
const styles = theme => ({
appBar: {
zIndex: theme.zIndex.drawer + 1,
},
navIconHide: {
[theme.breakpoints.up('md')]: {
display: 'none',
},
},
logo: {
height: theme.spacing.unit * 5
}
});
class Header extends Component {
render() {
const { loggedIn, onLogoClick, onToggleMenu, classes, user } = this.props;
return (
<AppBar color="default" position="static" className={classes.appBar}>
<Toolbar>
<IconButton
color="inherit"
aria-label="Open drawer"
onClick={onToggleMenu}
className={classes.navIconHide}
>
<MenuIcon />
</IconButton>
<Button color="inherit" aria-label="Logo" style={{marginRight: 9}}
onClick={onLogoClick}
>
<img className={classes.logo} src={logo} alt="logo" />
</Button>
<div style={{flex: 1}}>
</div>
{ loggedIn
? <authUI.UserMenu>
<JupyterMenu/>
{ user.admin
? <AdminMenu/>
: null
}
</authUI.UserMenu>
: <authUI.LoginButton />
}
</Toolbar>
</AppBar>
);
}
}
export default withStyles(styles)(Header);