github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/dashboard/assets/components/Body.jsx (about)

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