mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 14:09:11 -05:00
1e22d17520
Fix expand button tooltip text GitOrigin-RevId: db19ce6c21bf1a83f38a60014bd0aa92e220ce40
34 lines
957 B
TypeScript
34 lines
957 B
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import { Button } from 'react-bootstrap'
|
|
import Tooltip from '../../../shared/components/tooltip'
|
|
import Icon from '../../../shared/components/icon'
|
|
import { useMemo } from 'react'
|
|
import { useLayoutContext } from '../../../shared/context/layout-context'
|
|
|
|
function PdfExpandButton() {
|
|
const { pdfLayout, switchLayout } = useLayoutContext()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const text = useMemo(() => {
|
|
return pdfLayout === 'sideBySide' ? t('full_screen') : t('split_screen')
|
|
}, [pdfLayout, t])
|
|
|
|
return (
|
|
<Tooltip
|
|
id="expand-pdf-btn"
|
|
description={text}
|
|
overlayProps={{ placement: 'left' }}
|
|
>
|
|
<Button
|
|
onClick={switchLayout}
|
|
className="toolbar-pdf-expand-btn toolbar-item"
|
|
aria-label={text}
|
|
>
|
|
<Icon type={pdfLayout === 'sideBySide' ? 'expand' : 'compress'} />
|
|
</Button>
|
|
</Tooltip>
|
|
)
|
|
}
|
|
|
|
export default PdfExpandButton
|