all files / src/components/ Checkbox.jsx

100% Statements 8/8
100% Branches 2/2
100% Functions 1/1
100% Lines 6/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                                      
import React from 'react';
import PropTypes from 'prop-types';
 
const propTypes = {
  checked: PropTypes.bool.isRequired,
  onChange: PropTypes.func.isRequired,
  style: PropTypes.object,
};
 
export default function Checkbox({ checked, onChange, style }) {
  return (
    <span style={style}>
      <i
        className={`fa fa-check ${checked ? 'text-primary' : 'text-transparent'}`}
        onClick={onChange.bind(!checked)}
        style={{
          border: '1px solid #aaa',
          borderRadius: '2px',
          cursor: 'pointer',
        }}
      />
    </span>);
}
Checkbox.propTypes = propTypes;