CustomizeFunctionOption.jsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { withTranslation } from 'react-i18next';
  4. class CustomizeFunctionOption extends React.PureComponent {
  5. render() {
  6. return (
  7. <React.Fragment>
  8. <div className="custom-control custom-checkbox custom-checkbox-success">
  9. <input
  10. className="custom-control-input"
  11. type="checkbox"
  12. id={this.props.optionId}
  13. checked={this.props.isChecked}
  14. onChange={this.props.onChecked}
  15. />
  16. <label className="custom-control-label" htmlFor={this.props.optionId}>
  17. <strong>{this.props.label}</strong>
  18. </label>
  19. </div>
  20. {this.props.children}
  21. </React.Fragment>
  22. );
  23. }
  24. }
  25. CustomizeFunctionOption.propTypes = {
  26. t: PropTypes.func.isRequired, // i18next
  27. optionId: PropTypes.string.isRequired,
  28. label: PropTypes.string.isRequired,
  29. isChecked: PropTypes.bool.isRequired,
  30. onChecked: PropTypes.func.isRequired,
  31. children: PropTypes.object.isRequired,
  32. };
  33. export default withTranslation()(CustomizeFunctionOption);