mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 16:22:06 -05:00
32160a8c80
[web] Adjust dropdowns placement in history list GitOrigin-RevId: 050e16b97630eb37c890ad9a97a56ba882cca06b
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { forwardRef } from 'react'
|
|
import Tooltip from '../tooltip'
|
|
import classnames from 'classnames'
|
|
import { DropdownProps } from 'react-bootstrap'
|
|
import { MergeAndOverride } from '../../../../../types/utils'
|
|
|
|
type CustomToggleProps = MergeAndOverride<
|
|
Pick<DropdownProps, 'bsClass' | 'open'>,
|
|
{
|
|
children: React.ReactNode
|
|
bsRole: 'toggle'
|
|
className?: string
|
|
tooltipProps: Omit<React.ComponentProps<typeof Tooltip>, 'children'>
|
|
}
|
|
>
|
|
|
|
const DropdownToggleWithTooltip = forwardRef<
|
|
HTMLButtonElement,
|
|
CustomToggleProps
|
|
>(function (props, ref) {
|
|
const {
|
|
tooltipProps,
|
|
children,
|
|
bsClass,
|
|
className,
|
|
open,
|
|
bsRole: _bsRole,
|
|
...rest
|
|
} = props
|
|
|
|
return (
|
|
<Tooltip {...tooltipProps}>
|
|
<button
|
|
type="button"
|
|
ref={ref}
|
|
className={classnames(bsClass, 'btn', className)}
|
|
aria-expanded={open}
|
|
aria-haspopup="true"
|
|
{...rest}
|
|
>
|
|
{children}
|
|
</button>
|
|
</Tooltip>
|
|
)
|
|
})
|
|
DropdownToggleWithTooltip.displayName = 'DropdownToggleWithTooltip'
|
|
|
|
export default DropdownToggleWithTooltip
|