TriggerEventCheckBox.jsx 851 B

1234567891011121314151617181920212223242526272829303132333435
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { withTranslation } from 'react-i18next';
  4. const TriggerEventCheckBox = (props) => {
  5. const { t } = props;
  6. return (
  7. <div className="checkbox">
  8. <input
  9. type="checkbox"
  10. id={`trigger-event-${props.event}`}
  11. checked={props.checked}
  12. onChange={props.onChange}
  13. />
  14. <label htmlFor={`trigger-event-${props.event}`}>
  15. {props.children}{' '}
  16. {t(`notification_setting.event_${props.event}`)}
  17. </label>
  18. </div>
  19. );
  20. };
  21. TriggerEventCheckBox.propTypes = {
  22. t: PropTypes.func.isRequired, // i18next
  23. checked: PropTypes.bool.isRequired,
  24. onChange: PropTypes.func.isRequired,
  25. event: PropTypes.string.isRequired,
  26. children: PropTypes.object.isRequired,
  27. };
  28. export default withTranslation()(TriggerEventCheckBox);