All files / src/components/Form/CheckboxList/Checkbox index.jsx

33.33% Statements 2/6
100% Branches 0/0
0% Functions 0/2
33.33% Lines 2/6
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              3x                                   3x                
import styles from './style.postcss';
 
import React from 'react';
import pure from 'recompose/pure';
import classnames from 'classnames';
import PropTypes from 'prop-types';
 
const CheckBox = (props) => {
  const checked = props.checked === true;
  const classes = classnames(styles.Checkbox, { [styles.__checked]: checked });
 
  return <label className={classes}>
    <input type="checkbox"
        name={props.name}
        className={styles.Checkbox_input}
        onChange={onChange}
        checked={checked} />
    <span className={styles.Checkbox_text}>{props.item}</span>
  </label>;
 
  function onChange(e) {
    props.onChecked(e);
  }
};
 
CheckBox.propTypes = {
  name: PropTypes.string,
  item: PropTypes.string,
  onChecked: PropTypes.func,
  checked: PropTypes.bool,
};
 
export default pure(CheckBox);