github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/dashboard/assets/components/ChartRow.jsx (about)

     1  // @flow
     2  
     3  
     4  import React, {Component} from 'react';
     5  import type {ChildrenArray} from 'react';
     6  
     7  import Grid from 'material-ui/Grid';
     8  
     9  // styles contains the constant styles of the component.
    10  const styles = {
    11  	container: {
    12  		flexWrap: 'nowrap',
    13  		height:   '100%',
    14  		maxWidth: '100%',
    15  		margin:   0,
    16  	},
    17  	item: {
    18  		flex:    1,
    19  		padding: 0,
    20  	},
    21  }
    22  
    23  export type Props = {
    24  	children: ChildrenArray<React$Element<any>>,
    25  };
    26  
    27  // ChartRow renders a row of equally sized responsive charts.
    28  class ChartRow extends Component<Props> {
    29  	render() {
    30  		return (
    31  			<Grid container direction='row' style={styles.container} justify='space-between'>
    32  				{React.Children.map(this.props.children, child => (
    33  					<Grid item xs style={styles.item}>
    34  						{child}
    35  					</Grid>
    36  				))}
    37  			</Grid>
    38  		);
    39  	}
    40  }
    41  
    42  export default ChartRow;