mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 23:15:57 -05:00
4138f9707a
Migrate history versions list to Bootstrap 5 GitOrigin-RevId: 4e006ad353cb11eadaefb2df41d2b8591003c664
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { ReactNode, forwardRef } from 'react'
|
|
import { BsPrefixRefForwardingComponent } from 'react-bootstrap-5/helpers'
|
|
import type { DropdownToggleProps } from '@/features/ui/components/types/dropdown-menu-props'
|
|
import {
|
|
DropdownToggle as BS5DropdownToggle,
|
|
OverlayTrigger,
|
|
OverlayTriggerProps,
|
|
Tooltip,
|
|
} from 'react-bootstrap-5'
|
|
import type { MergeAndOverride } from '../../../../../../types/utils'
|
|
|
|
type DropdownToggleWithTooltipProps = MergeAndOverride<
|
|
DropdownToggleProps,
|
|
{
|
|
children: ReactNode
|
|
overlayTriggerProps?: Omit<OverlayTriggerProps, 'overlay' | 'children'>
|
|
toolTipDescription: string
|
|
tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>
|
|
'aria-label'?: string
|
|
}
|
|
>
|
|
const DropdownToggleWithTooltip = forwardRef<
|
|
BsPrefixRefForwardingComponent<'button', DropdownToggleProps>,
|
|
DropdownToggleWithTooltipProps
|
|
>(
|
|
(
|
|
{
|
|
children,
|
|
toolTipDescription,
|
|
overlayTriggerProps,
|
|
tooltipProps,
|
|
id,
|
|
...toggleProps
|
|
},
|
|
ref
|
|
) => {
|
|
return (
|
|
<OverlayTrigger
|
|
overlay={<Tooltip {...tooltipProps}>{toolTipDescription}</Tooltip>}
|
|
{...overlayTriggerProps}
|
|
>
|
|
<BS5DropdownToggle {...toggleProps} ref={ref}>
|
|
{children}
|
|
</BS5DropdownToggle>
|
|
</OverlayTrigger>
|
|
)
|
|
}
|
|
)
|
|
|
|
DropdownToggleWithTooltip.displayName = 'DropdownToggleWithTooltip'
|
|
|
|
export default DropdownToggleWithTooltip
|