| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | // @flow
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 19:34:00 +02:00
										 |  |  | // Copyright 2017 The go-ethereum Authors
 | 
					
						
							|  |  |  | // This file is part of the go-ethereum library.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // The go-ethereum library is free software: you can redistribute it and/or modify
 | 
					
						
							|  |  |  | // it under the terms of the GNU Lesser General Public License as published by
 | 
					
						
							|  |  |  | // the Free Software Foundation, either version 3 of the License, or
 | 
					
						
							|  |  |  | // (at your option) any later version.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // The go-ethereum library is distributed in the hope that it will be useful,
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 | 
					
						
							|  |  |  | // GNU Lesser General Public License for more details.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU Lesser General Public License
 | 
					
						
							|  |  |  | // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import React, {Component} from 'react'; | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | import withStyles from 'material-ui/styles/withStyles'; | 
					
						
							| 
									
										
										
										
											2017-11-14 19:34:00 +02:00
										 |  |  | import AppBar from 'material-ui/AppBar'; | 
					
						
							|  |  |  | import Toolbar from 'material-ui/Toolbar'; | 
					
						
							|  |  |  | import IconButton from 'material-ui/IconButton'; | 
					
						
							| 
									
										
										
										
											2018-03-08 10:22:21 +02:00
										 |  |  | import Icon from 'material-ui/Icon'; | 
					
						
							|  |  |  | import MenuIcon from 'material-ui-icons/Menu'; | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | import Typography from 'material-ui/Typography'; | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-16 10:43:58 +03:00
										 |  |  | // styles contains the constant styles of the component.
 | 
					
						
							|  |  |  | const styles = { | 
					
						
							|  |  |  | 	header: { | 
					
						
							|  |  |  | 		height: '8%', | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	toolbar: { | 
					
						
							|  |  |  | 		height: '100%', | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | // themeStyles returns the styles generated from the theme for the component.
 | 
					
						
							|  |  |  | const themeStyles = (theme: Object) => ({ | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | 	header: { | 
					
						
							| 
									
										
										
										
											2018-03-08 10:22:21 +02:00
										 |  |  | 		backgroundColor: theme.palette.grey[900], | 
					
						
							|  |  |  | 		color:           theme.palette.getContrastText(theme.palette.grey[900]), | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | 		zIndex:          theme.zIndex.appBar, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	toolbar: { | 
					
						
							|  |  |  | 		paddingLeft:  theme.spacing.unit, | 
					
						
							|  |  |  | 		paddingRight: theme.spacing.unit, | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | 	title: { | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | 		paddingLeft: theme.spacing.unit, | 
					
						
							| 
									
										
										
										
											2018-03-08 10:22:21 +02:00
										 |  |  | 		fontSize:    3 * theme.spacing.unit, | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2017-11-14 19:34:00 +02:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | export type Props = { | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | 	classes: Object, // injected by withStyles()
 | 
					
						
							|  |  |  | 	switchSideBar: () => void, | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | // Header renders the header of the dashboard.
 | 
					
						
							|  |  |  | class Header extends Component<Props> { | 
					
						
							|  |  |  | 	render() { | 
					
						
							| 
									
										
										
										
											2018-03-08 10:22:21 +02:00
										 |  |  | 		const {classes} = this.props; | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		return ( | 
					
						
							| 
									
										
										
										
											2018-07-16 10:43:58 +03:00
										 |  |  | 			<AppBar position='static' className={classes.header} style={styles.header}> | 
					
						
							|  |  |  | 				<Toolbar className={classes.toolbar} style={styles.toolbar}> | 
					
						
							| 
									
										
										
										
											2018-03-08 10:22:21 +02:00
										 |  |  | 					<IconButton onClick={this.props.switchSideBar}> | 
					
						
							|  |  |  | 						<Icon> | 
					
						
							|  |  |  | 							<MenuIcon /> | 
					
						
							|  |  |  | 						</Icon> | 
					
						
							|  |  |  | 					</IconButton> | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | 					<Typography type='title' color='inherit' noWrap className={classes.title}> | 
					
						
							| 
									
										
										
										
											2017-12-21 17:54:38 +02:00
										 |  |  | 						Go Ethereum Dashboard | 
					
						
							|  |  |  | 					</Typography> | 
					
						
							|  |  |  | 				</Toolbar> | 
					
						
							|  |  |  | 			</AppBar> | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-11-14 19:34:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-23 22:51:04 +02:00
										 |  |  | export default withStyles(themeStyles)(Header); |