overleaf/services/web/frontend/js/features/ui/components/ol/ol-tooltip.tsx
Rebeka Dekany f78e619d87 Merge pull request #18331 from overleaf/rd-bs5-renaming
[web ] Bootstrap 5 - rename the wrapper components and restructure

GitOrigin-RevId: 7a76903df81cd546e9e469f24c4f203ea6a61672
2024-05-16 08:05:31 +00:00

41 lines
1.1 KiB
TypeScript

import Tooltip from '@/features/ui/components/bootstrap-5/tooltip'
import BS3Tooltip from '@/shared/components/tooltip'
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
type OLTooltipProps = React.ComponentProps<typeof Tooltip> & {
bs3Props?: Record<string, unknown>
}
function OLTooltip(props: OLTooltipProps) {
const { bs3Props, ...bs5Props } = props
const bs3TooltipProps: React.ComponentProps<typeof BS3Tooltip> = {
children: bs5Props.children,
id: bs5Props.id,
description: bs5Props.description,
overlayProps: {},
...bs3Props,
}
if ('hidden' in bs5Props) {
bs3TooltipProps.hidden = bs5Props.hidden
}
const delay = bs5Props.overlayProps?.delay
if (delay && typeof delay !== 'number') {
bs3TooltipProps.overlayProps = {
...bs3TooltipProps.overlayProps,
delayShow: delay.show,
delayHide: delay.hide,
}
}
return (
<BootstrapVersionSwitcher
bs3={<BS3Tooltip {...bs3TooltipProps} />}
bs5={<Tooltip {...bs5Props} />}
/>
)
}
export default OLTooltip