mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
55e54ce875
Update PDF viewer controls GitOrigin-RevId: 4e15b7cbd34e878d0175be635369b8d620188203
37 lines
1,004 B
TypeScript
37 lines
1,004 B
TypeScript
import { ButtonGroup } from 'react-bootstrap'
|
|
import PDFToolbarButton from './pdf-toolbar-button'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
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 (
|
|
<ButtonGroup 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}
|
|
/>
|
|
</ButtonGroup>
|
|
)
|
|
}
|
|
|
|
export default PdfZoomButtons
|