import { Overlay, OverlayProps } from 'react-bootstrap-5' import { Overlay as BS3Overlay, OverlayProps as BS3OverlayProps, } from 'react-bootstrap' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' type OLOverlayProps = OverlayProps & { bs3Props?: BS3OverlayProps } function OLOverlay(props: OLOverlayProps) { const { bs3Props, ...bs5Props } = props let bs3OverlayProps: BS3OverlayProps = { children: bs5Props.children, target: bs5Props.target as BS3OverlayProps['target'], container: bs5Props.container, containerPadding: bs5Props.containerPadding, show: bs5Props.show, rootClose: bs5Props.rootClose, animation: bs5Props.transition, onHide: bs5Props.onHide as BS3OverlayProps['onHide'], onEnter: bs5Props.onEnter as BS3OverlayProps['onEnter'], onEntering: bs5Props.onEntering as BS3OverlayProps['onEntering'], onEntered: bs5Props.onEntered as BS3OverlayProps['onEntered'], onExit: bs5Props.onExit as BS3OverlayProps['onExit'], onExiting: bs5Props.onExiting as BS3OverlayProps['onExiting'], onExited: bs5Props.onExited as BS3OverlayProps['onExited'], } if (bs5Props.placement) { const bs3PlacementOptions = [ 'top', 'right', 'bottom', 'left', ] satisfies Array< Extract > for (const placement of bs3PlacementOptions) { if (placement === bs5Props.placement) { bs3OverlayProps.placement = bs5Props.placement break } } } bs3OverlayProps = { ...bs3OverlayProps, ...bs3Props } return ( } bs5={} /> ) } export default OLOverlay