mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
e95ad3e71b
GitOrigin-RevId: b8029b65c95ccdac89587d484e2599e25fe44302
33 lines
813 B
TypeScript
33 lines
813 B
TypeScript
import type { FC, ReactNode } from 'react'
|
|
import {
|
|
OverlayTrigger,
|
|
OverlayTriggerProps,
|
|
Tooltip as BSTooltip,
|
|
} from 'react-bootstrap'
|
|
|
|
type OverlayProps = Omit<OverlayTriggerProps, 'overlay'> & {
|
|
shouldUpdatePosition?: boolean // Not officially documented https://stackoverflow.com/a/43138470
|
|
}
|
|
|
|
const Tooltip: FC<{
|
|
description: ReactNode
|
|
id: string
|
|
overlayProps?: OverlayProps
|
|
tooltipProps?: BSTooltip.TooltipProps
|
|
}> = ({ id, description, children, tooltipProps, overlayProps }) => {
|
|
return (
|
|
<OverlayTrigger
|
|
overlay={
|
|
<BSTooltip id={`${id}-tooltip`} {...tooltipProps}>
|
|
{description}
|
|
</BSTooltip>
|
|
}
|
|
{...overlayProps}
|
|
placement={overlayProps?.placement || 'top'}
|
|
>
|
|
{children}
|
|
</OverlayTrigger>
|
|
)
|
|
}
|
|
|
|
export default Tooltip
|