2022-07-20 10:01:48 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { Button } from 'react-bootstrap'
|
|
|
|
import Icon from '../../../shared/components/icon'
|
|
|
|
import { useLayoutContext } from '../../../shared/context/layout-context'
|
|
|
|
|
|
|
|
function SwitchToPDFButton() {
|
|
|
|
const { pdfLayout, setView, detachRole } = useLayoutContext()
|
|
|
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
if (detachRole) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pdfLayout === 'sideBySide') {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleClick() {
|
|
|
|
setView('pdf')
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
2022-12-07 05:51:18 -05:00
|
|
|
bsStyle={null}
|
2022-07-20 10:01:48 -04:00
|
|
|
bsSize="xs"
|
|
|
|
onClick={handleClick}
|
2023-06-06 12:42:28 -04:00
|
|
|
className="switch-to-pdf-btn toolbar-btn-secondary btn-secondary"
|
2022-07-20 10:01:48 -04:00
|
|
|
>
|
2023-06-06 12:42:28 -04:00
|
|
|
<Icon type="file-pdf-o" className="toolbar-btn-secondary-icon" />
|
|
|
|
<span className="toolbar-btn-secondary-text">{t('switch_to_pdf')}</span>
|
2022-07-20 10:01:48 -04:00
|
|
|
</Button>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SwitchToPDFButton
|