overleaf/services/web/frontend/js/shared/components/tooltip.tsx
Timothée Alby cf2dfc6bf1 Merge pull request #7593 from overleaf/ta-settings-migration
[SettingsPage] Integration Branch

GitOrigin-RevId: 5a3c26b2a02d716c4ae3981e3f08b811ae307725
2022-04-25 08:05:12 +00:00

37 lines
694 B
TypeScript

import {
OverlayTrigger,
OverlayTriggerProps,
Tooltip as BSTooltip,
} from 'react-bootstrap'
type TooltipProps = {
children: React.ReactNode
description: string
id: string
overlayProps?: Omit<OverlayTriggerProps, 'overlay'>
tooltipProps?: BSTooltip.TooltipProps
}
function Tooltip({
id,
description,
children,
tooltipProps,
overlayProps,
}: TooltipProps) {
return (
<OverlayTrigger
overlay={
<BSTooltip id={`${id}-tooltip`} {...tooltipProps}>
{description}
</BSTooltip>
}
{...overlayProps}
placement={overlayProps?.placement || 'top'}
>
{children}
</OverlayTrigger>
)
}
export default Tooltip