Body.jsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // @flow
  2. // Copyright 2017 The go-ethereum Authors
  3. // This file is part of the go-ethereum library.
  4. //
  5. // The go-ethereum library is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU Lesser General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // The go-ethereum library is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU Lesser General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public License
  16. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
  17. import React, {Component} from 'react';
  18. import withStyles from 'material-ui/styles/withStyles';
  19. import SideBar from './SideBar';
  20. import Main from './Main';
  21. import type {Content} from '../types/content';
  22. // Styles for the Body component.
  23. const styles = () => ({
  24. body: {
  25. display: 'flex',
  26. width: '100%',
  27. height: '100%',
  28. },
  29. });
  30. export type Props = {
  31. classes: Object,
  32. opened: boolean,
  33. changeContent: () => {},
  34. active: string,
  35. content: Content,
  36. shouldUpdate: Object,
  37. };
  38. // Body renders the body of the dashboard.
  39. class Body extends Component<Props> {
  40. render() {
  41. const {classes} = this.props; // The classes property is injected by withStyles().
  42. return (
  43. <div className={classes.body}>
  44. <SideBar
  45. opened={this.props.opened}
  46. changeContent={this.props.changeContent}
  47. />
  48. <Main
  49. active={this.props.active}
  50. content={this.props.content}
  51. shouldUpdate={this.props.shouldUpdate}
  52. />
  53. </div>
  54. );
  55. }
  56. }
  57. export default withStyles(styles)(Body);