overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-zoom-buttons.tsx
ilkin-overleaf 92eade7502 Merge pull request #20708 from overleaf/ii-bs5-pdf-toolbar
[web] BS5 pdf toolbar

GitOrigin-RevId: a04091c9e936e52f47c3977b3149ffe613d43bb9
2024-10-14 11:06:17 +00:00

37 lines
1 KiB
TypeScript

import PDFToolbarButton from './pdf-toolbar-button'
import { useTranslation } from 'react-i18next'
import OLButtonGroup from '@/features/ui/components/ol/ol-button-group'
const isMac = /Mac/.test(window.navigator?.platform)
type PdfZoomButtonsProps = {
setZoom: (zoom: string) => void
}
function PdfZoomButtons({ setZoom }: PdfZoomButtonsProps) {
const { t } = useTranslation()
const zoomInShortcut = isMac ? '⌘+' : 'Ctrl++'
const zoomOutShortcut = isMac ? '⌘-' : 'Ctrl+-'
return (
<OLButtonGroup className="pdfjs-toolbar-buttons">
<PDFToolbarButton
tooltipId="pdf-controls-zoom-out-tooltip"
label={t('zoom_out')}
icon="remove"
onClick={() => setZoom('zoom-out')}
shortcut={zoomOutShortcut}
/>
<PDFToolbarButton
tooltipId="pdf-controls-zoom-in-tooltip"
label={t('zoom_in')}
icon="add"
onClick={() => setZoom('zoom-in')}
shortcut={zoomInShortcut}
/>
</OLButtonGroup>
)
}
export default PdfZoomButtons