pdf-toolbar-button.tsx 946 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import Button from 'react-bootstrap/lib/Button'
  2. import MaterialIcon from '@/shared/components/material-icon'
  3. import Tooltip from '@/shared/components/tooltip'
  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. <Tooltip
  22. id={tooltipId}
  23. description={
  24. <>
  25. <div>{label}</div>
  26. {shortcut && <div>{shortcut}</div>}
  27. </>
  28. }
  29. overlayProps={{ placement: 'bottom' }}
  30. >
  31. <Button
  32. aria-label={label}
  33. bsSize="large"
  34. bsStyle={null}
  35. className="pdf-toolbar-btn pdfjs-toolbar-button"
  36. disabled={disabled}
  37. onClick={onClick}
  38. >
  39. <MaterialIcon type={icon} />
  40. </Button>
  41. </Tooltip>
  42. )
  43. }