overleaf/services/web/frontend/js/features/editor-navigation-toolbar/components/pdf-toggle-button.tsx
Timothée Alby 5731463d32 Merge pull request #7956 from overleaf/ii-refactor-toolitp-usage
Tooltip usage refactoring

GitOrigin-RevId: f4b2d4d57722172141a081dd60e4394ff7fff332
2022-05-19 08:04:07 +00:00

34 lines
924 B
TypeScript

import classNames from 'classnames'
import Tooltip from '../../../shared/components/tooltip'
import Icon from '../../../shared/components/icon'
type PdfToggleButtonProps = {
onClick: () => void
pdfViewIsOpen?: boolean
}
function PdfToggleButton({ onClick, pdfViewIsOpen }: PdfToggleButtonProps) {
const classes = classNames(
'btn',
'btn-full-height',
'btn-full-height-no-border',
{
active: pdfViewIsOpen,
}
)
return (
<Tooltip
id="online-user"
description="PDF"
overlayProps={{ placement: 'bottom', trigger: ['hover', 'focus'] }}
>
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid,jsx-a11y/click-events-have-key-events,jsx-a11y/interactive-supports-focus */}
<a role="button" className={classes} onClick={onClick}>
<Icon type="file-pdf-o" fw accessibilityLabel="PDF" />
</a>
</Tooltip>
)
}
export default PdfToggleButton