import { clsx } from 'clsx'; import { forwardRef, useImperativeHandle, useRef } from 'react'; import { CSSTransition } from 'react-transition-group'; import { Position } from '../common'; export const EXIT_ANIMATION = 350; export interface SlidingPanelProps extends Pick< React.ComponentPropsWithRef<'div'>, 'ref' | 'className' | 'children' > { position?: `${Position.TOP | Position.RIGHT | Position.BOTTOM | Position.LEFT}`; open: boolean; showSlidingPanelBorder?: boolean; slidingPanelPositionFixed?: boolean; testId?: string; } const SlidingPanel = forwardRef( ( { position = 'left', open, showSlidingPanelBorder, slidingPanelPositionFixed, className, children, testId, ...rest }: Omit, reference: React.ForwardedRef, ) => { const localReference = useRef(null as never); useImperativeHandle(reference, () => localReference.current, []); return (
{children}
); }, ); export default SlidingPanel;