overleaf-cep/services/web/frontend/js/features/source-editor/components/switch-to-pdf-button.jsx
Alf Eaton 2147f1d53d Remove Bootstrap 3 code from IDE page components (#23061)
GitOrigin-RevId: b41aff10672bf96e892de0be396a69eb25e2443b
2025-03-07 09:05:45 +00:00

31 lines
729 B
JavaScript

import { useTranslation } from 'react-i18next'
import MaterialIcon from '@/shared/components/material-icon'
import OLButton from '@/features/ui/components/ol/ol-button'
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 (
<OLButton variant="secondary" size="sm" onClick={handleClick}>
<MaterialIcon type="picture_as_pdf" />
{t('switch_to_pdf')}
</OLButton>
)
}
export default SwitchToPDFButton