2021-09-30 07:29:25 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2022-05-18 09:46:10 -04:00
|
|
|
import { Button } from 'react-bootstrap'
|
|
|
|
import Tooltip from '../../../shared/components/tooltip'
|
2021-09-30 07:29:25 -04:00
|
|
|
import Icon from '../../../shared/components/icon'
|
2022-05-18 09:46:10 -04:00
|
|
|
import { useMemo } from 'react'
|
2021-10-15 05:39:56 -04:00
|
|
|
import { useLayoutContext } from '../../../shared/context/layout-context'
|
2021-09-30 07:29:25 -04:00
|
|
|
|
|
|
|
function PdfExpandButton() {
|
2022-06-08 10:07:07 -04:00
|
|
|
const { pdfLayout, switchLayout, detachRole } = useLayoutContext()
|
2021-09-30 07:29:25 -04:00
|
|
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
const text = useMemo(() => {
|
|
|
|
return pdfLayout === 'sideBySide' ? t('full_screen') : t('split_screen')
|
|
|
|
}, [pdfLayout, t])
|
|
|
|
|
2022-06-08 10:07:07 -04:00
|
|
|
if (detachRole) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2021-09-30 07:29:25 -04:00
|
|
|
return (
|
2022-05-18 09:46:10 -04:00
|
|
|
<Tooltip
|
|
|
|
id="expand-pdf-btn"
|
2022-05-20 09:31:38 -04:00
|
|
|
description={text}
|
2022-05-18 09:46:10 -04:00
|
|
|
overlayProps={{ placement: 'left' }}
|
2021-09-30 07:29:25 -04:00
|
|
|
>
|
|
|
|
<Button
|
|
|
|
onClick={switchLayout}
|
|
|
|
className="toolbar-pdf-expand-btn toolbar-item"
|
|
|
|
aria-label={text}
|
|
|
|
>
|
|
|
|
<Icon type={pdfLayout === 'sideBySide' ? 'expand' : 'compress'} />
|
|
|
|
</Button>
|
2022-05-18 09:46:10 -04:00
|
|
|
</Tooltip>
|
2021-09-30 07:29:25 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:46:10 -04:00
|
|
|
export default PdfExpandButton
|