history-toggle-button.js 747 B

123456789101112131415161718192021222324252627
  1. import PropTypes from 'prop-types'
  2. import classNames from 'classnames'
  3. import { useTranslation } from 'react-i18next'
  4. import Icon from '../../../shared/components/icon'
  5. function HistoryToggleButton({ historyIsOpen, onClick }) {
  6. const { t } = useTranslation()
  7. const classes = classNames('btn', 'btn-full-height', {
  8. active: historyIsOpen,
  9. })
  10. return (
  11. // eslint-disable-next-line jsx-a11y/anchor-is-valid
  12. <a role="button" className={classes} href="#" onClick={onClick}>
  13. <Icon type="fw" modifier="history" />
  14. <p className="toolbar-label">{t('history')}</p>
  15. </a>
  16. )
  17. }
  18. HistoryToggleButton.propTypes = {
  19. historyIsOpen: PropTypes.bool,
  20. onClick: PropTypes.func.isRequired,
  21. }
  22. export default HistoryToggleButton