import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from "@headlessui/react"; import { XMarkIcon } from "@heroicons/react/24/outline"; import { cva, type VariantProps } from "class-variance-authority"; import type { ReactNode, SyntheticEvent } from "react"; import { Fragment, memo } from "react"; const modalVariants = cva( "inline-block w-full scale-100 rounded-xl bg-white text-left align-bottom shadow-xl transition-all sm:my-8 sm:align-middle dark:bg-gray-800", { defaultVariants: { size: "sm" }, variants: { size: { lg: "sm:max-w-5xl", md: "sm:max-w-3xl", sm: "sm:max-w-lg", xs: "sm:max-w-sm" } } } ); interface ModalProps extends VariantProps { children: ReactNode | ReactNode[]; onClose?: () => void; show: boolean; title?: ReactNode; } const Modal = ({ children, onClose, show, size = "sm", title }: ModalProps) => { const handleClose = (event: SyntheticEvent) => { event.stopPropagation(); // This stops the event from propagating further onClose?.(); }; return ( onClose?.()} > ); }; export default memo(Modal);