'use client'; import React, { useRef } from 'react' import BlurredOverlayContainer, { BlurredOverlayContainerProps } from '../overlays/BlurredOverlayContainer' import clsx from 'clsx' import CloseIcon from '../icons/CloseIcon' import { motion, PanInfo, Variants } from 'framer-motion' type Props = { title?: string, showCloseButton?: boolean, showTitle?: boolean, blurOpacity?: string | number | null, overrideClassName?: string, titlePadding?: string, } & BlurredOverlayContainerProps const AnimatedBottomSheet = ({ blurOpacity = 64, overrideClassName = '', showTitle = true, showCloseButton = true, titlePadding = 'ps-[31px] pe-[33px]', ...props }: Props) => { const closeRef: React.Ref | undefined = useRef(null); const variants: Variants = { hidden: { y: '100%', }, visible: { y: 0, transition: { duration: 0.1, ease: 'easeInOut', }, }, }; const onDrag = (_event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => { if (info.offset.y > 200) { if (closeRef.current) { closeRef.current.click(); } } } return (
{showTitle &&
{props.title}
} {showCloseButton &&
}
{props.children}
) } export default AnimatedBottomSheet