pdf-toolbar-button.tsx 948 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import MaterialIcon from '@/shared/components/material-icon'
  2. import OLTooltip from '@/shared/components/ol/ol-tooltip'
  3. import OLButton from '@/shared/components/ol/ol-button'
  4. type PDFToolbarButtonProps = {
  5. tooltipId: string
  6. icon: string
  7. label: string
  8. onClick: () => void
  9. shortcut?: string
  10. disabled?: boolean
  11. }
  12. export default function PDFToolbarButton({
  13. tooltipId,
  14. disabled,
  15. label,
  16. icon,
  17. onClick,
  18. shortcut,
  19. }: PDFToolbarButtonProps) {
  20. return (
  21. <OLTooltip
  22. id={tooltipId}
  23. description={
  24. <>
  25. <div>{label}</div>
  26. {shortcut && <div>{shortcut}</div>}
  27. </>
  28. }
  29. overlayProps={{ placement: 'bottom' }}
  30. >
  31. <OLButton
  32. variant="ghost"
  33. className="pdf-toolbar-btn pdfjs-toolbar-button"
  34. disabled={disabled}
  35. onClick={onClick}
  36. aria-label={label}
  37. >
  38. <MaterialIcon type={icon} />
  39. </OLButton>
  40. </OLTooltip>
  41. )
  42. }