// @flow import React from 'react' import withProps from 'recompose/withProps' import { map, reverse } from 'ramda' import Box from '../../elements/Box' import Text from '../../elements/Text' import Grid from '../../elements/Grid' import RemoveButton from '../../elements/RemoveButton' type Props = { list: Array<{ term: string, desc: string | Array<{}>, descKeys?: Array, }>, handleDelete?: ?() => void, } const SimpleListItem = ({ list, handleDelete }: Props) => ( { map(item => ( {item.term} { typeof item.desc === 'object' ? ( { map(descItem => ( map(val => ( {descItem[val]} ), item.descKeys) ), reverse(item.desc)) } ) : ( {item.desc} ) } ), list) } { handleDelete != null && } ) SimpleListItem.defaultProps = { handleDelete: null, } // ------------------------------------- const Heading = withProps({ fontSize: 4, color: 'darkerBlue', pb: 2, })(Text) const Description = withProps({ color: 'darkGray', })(Text) export default SimpleListItem