switch-to-pdf-button.jsx 866 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { useTranslation } from 'react-i18next'
  2. import { Button } from 'react-bootstrap'
  3. import Icon from '../../../shared/components/icon'
  4. import { useLayoutContext } from '../../../shared/context/layout-context'
  5. function SwitchToPDFButton() {
  6. const { pdfLayout, setView, detachRole } = useLayoutContext()
  7. const { t } = useTranslation()
  8. if (detachRole) {
  9. return null
  10. }
  11. if (pdfLayout === 'sideBySide') {
  12. return null
  13. }
  14. function handleClick() {
  15. setView('pdf')
  16. }
  17. return (
  18. <Button
  19. bsStyle={null}
  20. bsSize="xs"
  21. onClick={handleClick}
  22. className="switch-to-pdf-btn toolbar-btn-secondary btn-secondary"
  23. >
  24. <Icon type="file-pdf-o" className="toolbar-btn-secondary-icon" />
  25. <span className="toolbar-btn-secondary-text">{t('switch_to_pdf')}</span>
  26. </Button>
  27. )
  28. }
  29. export default SwitchToPDFButton