overleaf/services/web/frontend/js/features/ui/components/ol/ol-dropdown-menu-item.tsx
Tim Down 4138f9707a Merge pull request #20860 from overleaf/td-bs5-history-versions-list
Migrate history versions list to Bootstrap 5

GitOrigin-RevId: 4e006ad353cb11eadaefb2df41d2b8591003c664
2024-10-14 11:11:01 +00:00

37 lines
990 B
TypeScript

import { MenuItem, MenuItemProps } from 'react-bootstrap'
import { DropdownItem } from '@/features/ui/components/bootstrap-5/dropdown-menu'
import { DropdownItemProps } from '@/features/ui/components/types/dropdown-menu-props'
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
type OLDropdownMenuItemProps = DropdownItemProps & {
bs3Props?: MenuItemProps
}
function OLDropdownMenuItem(props: OLDropdownMenuItemProps) {
const { bs3Props, ...rest } = props
const bs3MenuItemProps: MenuItemProps = {
children: rest.leadingIcon ? (
<>
{rest.leadingIcon}
&nbsp;
{rest.children}
</>
) : (
rest.children
),
onClick: rest.onClick,
href: rest.href,
download: rest.download,
...bs3Props,
}
return (
<BootstrapVersionSwitcher
bs3={<MenuItem {...bs3MenuItemProps} />}
bs5={<DropdownItem {...rest} />}
/>
)
}
export default OLDropdownMenuItem