history-toggle-button.js 771 B

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