All files / components/input-radio index.js

0% Statements 0/40
0% Branches 0/14
0% Functions 0/5
0% Lines 0/2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50                                                                                                   
import React from 'react'
import PropTypes from 'prop-types'
import StyledRadio from './styled-radio'
 
const Radio = ({
  name,
  id,
  label,
  text,
  disabled,
  checked,
  onChange,
  className,
  ...rest
}) => (
  <StyledRadio
    className={className}
  >
    {label && <div className='label'>{label}</div>}
    <div className='radio-items-list'>
      <div className='radio-item'>
        <input
          {...rest}
          type='radio'
          id={id}
          name={name}
          disabled={disabled}
          checked={checked}
          onChange={onChange}
        />
        <label htmlFor={id}>{text}</label>
      </div>
    </div>
  </StyledRadio>
)
 
Radio.propTypes = {
  name: PropTypes.string,
  id: PropTypes.string,
  label: PropTypes.string,
  text: PropTypes.string.isRequired,
  disabled: PropTypes.bool,
  checked: PropTypes.bool,
  onChange: PropTypes.func,
  className: PropTypes.string
}
 
export { RadioGroup } from './radio-group'
export { Radio }