import { ReactNode, Fragment } from "react"; import { Dialog, DialogBackdrop, DialogPanel, Transition, TransitionChild } from "@headlessui/react"; import clsx from "clsx"; interface Props { className?: string; children: ReactNode; open: boolean; setOpen: React.Dispatch>; size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "full"; padding?: "none" | "sm"; position?: 0 | 1 | 2 | 3 | 4 | 5; title?: ReactNode; "data-ui-id"?: string; } export default function Modal({ className, children, open, setOpen, size = "3xl", padding = "sm", position = 5, title, "data-ui-id": dataUiId }: Props) { function onClose() { setOpen(false); } return (
{/* This element is to trick the browser into centering the modal contents. */} {title && (

{title}

)} {children}
); }