// @flow import React from 'react' import withProps from 'recompose/withProps' import { map } from 'ramda' import Box from '../../elements/Box' import Text from '../../elements/Text' type Props = { headers: Array, rows: Array<{ values: Array, }>, } const Table = ({ headers, rows }: Props) => ( { map(header => ( {header} ), headers) } { map(row => ( { map(datum => ( {datum} ), row.values) } ), rows) } ) // ------------------------------------- const Th = withProps({ fontSize: 2, fontWeight: 'normal', color: 'blue', textAlign: 'left', pb: 2, })(Text.withComponent('th')) const Td = withProps({ fontSize: 2, color: 'darkGray', pb: 2, })(Text.withComponent('td')) const TableEl = withProps({ maxWidth: 600, })(Box.withComponent('table')) export default Table