github.com/alexdevranger/node-1.8.27@v0.0.0-20221128213301-aa5841e41d2d/dashboard/assets/components/ChartRow.jsx (about)

     1  // @flow
     2  
     3  // Copyright 2018 The go-ethereum Authors
     4  // This file is part of the go-dubxcoin library.
     5  //
     6  // The go-dubxcoin 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 go-dubxcoin 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 go-dubxcoin library. If not, see <http://www.gnu.org/licenses/>.
    18  
    19  import React, { Component } from "react";
    20  import type { ChildrenArray } from "react";
    21  
    22  import Grid from "material-ui/Grid";
    23  
    24  // styles contains the constant styles of the component.
    25  const styles = {
    26    container: {
    27      flexWrap: "nowrap",
    28      height: "100%",
    29      maxWidth: "100%",
    30      margin: 0,
    31    },
    32    item: {
    33      flex: 1,
    34      padding: 0,
    35    },
    36  };
    37  
    38  export type Props = {
    39    children: ChildrenArray<React$Element<any>>,
    40  };
    41  
    42  // ChartRow renders a row of equally sized responsive charts.
    43  class ChartRow extends Component<Props> {
    44    render() {
    45      return (
    46        <Grid
    47          container
    48          direction="row"
    49          style={styles.container}
    50          justify="space-between"
    51        >
    52          {React.Children.map(this.props.children, (child) => (
    53            <Grid item xs style={styles.item}>
    54              {child}
    55            </Grid>
    56          ))}
    57        </Grid>
    58      );
    59    }
    60  }
    61  
    62  export default ChartRow;