// @flow import React, { Fragment, PureComponent } from 'react' import { keys, map, prop } from 'ramda' import ErrorMessage from '../../elements/ErrorMessage' import Grid from '../../elements/Grid' import GridBox from '../../elements/GridBox' import { DecalLabel } from '../../elements/Decal' import Radio from '../../elements/Radio' import { type EventType, type InputType, type MetaType } from '../../types' type Props = { change?: (string | () => string, string | () => string) => void, direction?: string, input?: InputType, meta: MetaType, readOnly?: boolean, values: {}, } class DoubleRadioGroup extends PureComponent { static defaultProps = { change: null, direction: 'horizontal', readOnly: false, input: { name: null }, } handleOnChange = (e: EventType) => { const { target } = e const { change, input } = this.props if (change && input) { change(input.name, target.value) } } render() { const { change, direction, input, meta, readOnly, values } = this.props return ( { map(key => ( {key} { map( ({ label, value }) => ( ), values[key], ) } ), keys(values)) } {meta.touched && meta.error && ( ) } ) } } export default DoubleRadioGroup