2024-05-29 10:17:37 -04:00
|
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
2024-10-08 10:22:13 -04:00
|
|
|
import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
|
|
|
|
import OLButton from '@/features/ui/components/ol/ol-button'
|
2024-05-29 10:17:37 -04:00
|
|
|
|
|
|
|
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 (
|
2024-10-08 10:22:13 -04:00
|
|
|
<OLTooltip
|
2024-05-29 10:17:37 -04:00
|
|
|
id={tooltipId}
|
|
|
|
description={
|
|
|
|
<>
|
|
|
|
<div>{label}</div>
|
|
|
|
{shortcut && <div>{shortcut}</div>}
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
overlayProps={{ placement: 'bottom' }}
|
|
|
|
>
|
2024-10-08 10:22:13 -04:00
|
|
|
<OLButton
|
|
|
|
variant="ghost"
|
2024-05-31 04:51:27 -04:00
|
|
|
className="pdf-toolbar-btn pdfjs-toolbar-button"
|
2024-05-29 10:17:37 -04:00
|
|
|
disabled={disabled}
|
|
|
|
onClick={onClick}
|
2024-10-08 10:22:13 -04:00
|
|
|
aria-label={label}
|
2024-05-29 10:17:37 -04:00
|
|
|
>
|
|
|
|
<MaterialIcon type={icon} />
|
2024-10-08 10:22:13 -04:00
|
|
|
</OLButton>
|
|
|
|
</OLTooltip>
|
2024-05-29 10:17:37 -04:00
|
|
|
)
|
|
|
|
}
|