Checkbox.jsx 681 B

123456789101112131415161718192021222324
  1. import React from 'react';
  2. import { useSelector } from 'react-redux';
  3. import './Checkbox.scss';
  4. function toggleAll(props, e) {
  5. props.toggleAll(e.target.checked);
  6. }
  7. const Checkbox = (props) => {
  8. const { i18n } = useSelector(state => state.session);
  9. return (
  10. <div className="input-group-prepend">
  11. <div className="input-group-text">
  12. <input type="checkbox" onChange={(e) => toggleAll(props, e)} aria-label="Checkbox for following text input" id="checkbox" checked={props.toggled} />
  13. </div>
  14. <span className="input-group-text">
  15. <label htmlFor="checkbox">{i18n['toggle all']}</label>
  16. </span>
  17. </div>
  18. );
  19. }
  20. export default Checkbox;