PurposeTypeRadioGroup.tsx 1.07 KB
Newer Older
1
import * as React from 'react';
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
2
import {translate} from 'react-i18next';
3 4 5 6 7 8 9 10

import FormControlLabel from '@material-ui/core/FormControlLabel';
import FormLabel from '@material-ui/core/FormLabel';
import FormControl from '@material-ui/core/FormControl';
import Radio from '@material-ui/core/Radio';
import RadioGroup from '@material-ui/core/RadioGroup';
import {PURPOSE_TYPES} from 'model/request/RequestInfo';

Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
11
const PurposeTypeRadioGroup = ({input, meta, classes, formLabel, t, ...rest}) => (
12
  <FormControl required>
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
13
    <FormLabel>{ formLabel }</FormLabel>
14 15 16 17 18 19 20 21 22 23 24 25 26
    <RadioGroup
      { ...input }
      { ...rest }
      value={ input.value }
      onChange={
        (event, value) => input.onChange(value) // tslint:disable-line
      }
    >
      {
        PURPOSE_TYPES.map((purposeType) => (
          <FormControlLabel
            key={ purposeType.value }
            value={ purposeType.value }
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
27
            label={ t(purposeType.label) }
28 29 30 31 32 33 34 35
            control={ <Radio/> }
          />
        ))
      }
    </RadioGroup>
  </FormControl>
);

Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
36
export default translate()(PurposeTypeRadioGroup);