InputCheckbox.jsx 985B

123456789101112131415161718192021222324252627282930313233343536
  1. import React from 'react'
  2. import PropTypes from 'prop-types'
  3. import classnames from 'classnames'
  4. const InputGroupText = props => {
  5. return (
  6. <label className={classnames(`${props.parentClassName}`, props.customClass, 'custom-control custom-checkbox')}>
  7. <input
  8. type='checkbox'
  9. className='custom-control-input'
  10. checked={props.checked}
  11. onChange={props.onChange}
  12. />
  13. <span className={classnames(`${props.parentClassName}__checkbox`, 'custom-control-indicator')} />
  14. <span className={classnames(`${props.parentClassName}__label`, 'custom-control-description')}>
  15. {props.label}
  16. </span>
  17. </label>
  18. )
  19. }
  20. export default InputGroupText
  21. InputGroupText.propTypes = {
  22. parentClassName: PropTypes.string.isRequired,
  23. checked: PropTypes.bool.isRequired,
  24. onChange: PropTypes.func.isRequired,
  25. customClass: PropTypes.string,
  26. label: PropTypes.string
  27. }
  28. InputGroupText.defaultProps = {
  29. customClass: '',
  30. label: ''
  31. }