overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-toolbar-button.tsx
David 55e54ce875 Merge pull request #18435 from overleaf/dp-ae-pdf-viewer-controls
Update PDF viewer controls

GitOrigin-RevId: 4e15b7cbd34e878d0175be635369b8d620188203
2024-05-30 08:05:06 +00:00

45 lines
930 B
TypeScript

import Button from 'react-bootstrap/lib/Button'
import MaterialIcon from '@/shared/components/material-icon'
import Tooltip from '@/shared/components/tooltip'
type PDFToolbarButtonProps = {
tooltipId: string
icon: string
label: string
onClick: () => void
shortcut?: string
disabled?: boolean
}
export default function PDFToolbarButton({
tooltipId,
disabled,
label,
icon,
onClick,
shortcut,
}: PDFToolbarButtonProps) {
return (
<Tooltip
id={tooltipId}
description={
<>
<div>{label}</div>
{shortcut && <div>{shortcut}</div>}
</>
}
overlayProps={{ placement: 'bottom' }}
>
<Button
aria-label={label}
bsSize="large"
bsStyle={null}
className="pdfjs-toolbar-button"
disabled={disabled}
onClick={onClick}
>
<MaterialIcon type={icon} />
</Button>
</Tooltip>
)
}