track-changes-toggle-button.jsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import PropTypes from 'prop-types'
  2. import classNames from 'classnames'
  3. import { useTranslation } from 'react-i18next'
  4. import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
  5. import MaterialIcon from '@/shared/components/material-icon'
  6. function TrackChangesToggleButton({
  7. trackChangesIsOpen,
  8. disabled,
  9. onMouseDown,
  10. }) {
  11. const { t } = useTranslation()
  12. const classes = classNames('btn', 'btn-full-height', {
  13. active: trackChangesIsOpen && !disabled,
  14. disabled,
  15. })
  16. return (
  17. <div className="toolbar-item">
  18. <button
  19. type="button"
  20. disabled={disabled}
  21. className={classes}
  22. onMouseDown={onMouseDown}
  23. >
  24. <BootstrapVersionSwitcher
  25. bs3={<i className="review-icon" />}
  26. bs5={<MaterialIcon type="rate_review" className="align-middle" />}
  27. />
  28. <p className="toolbar-label">{t('review')}</p>
  29. </button>
  30. </div>
  31. )
  32. }
  33. TrackChangesToggleButton.propTypes = {
  34. trackChangesIsOpen: PropTypes.bool,
  35. disabled: PropTypes.bool,
  36. onMouseDown: PropTypes.func.isRequired,
  37. }
  38. export default TrackChangesToggleButton