import { Fragment, ReactNode } from "react"; // Headless ui imports import { Dialog, Transition } from "@headlessui/react"; // Design components import Button from "ui/Button"; // Icons import { XMarkIcon } from "@heroicons/react/24/outline"; type ModalProps = { isModal: boolean; setModal: Function; size?: "xs" | "rg" | "lg" | "xl"; position?: "top" | "center" | "bottom"; title: string; children: ReactNode; buttons?: ReactNode; onClose?: Function; closeButton?: string; continueButton?: string; }; const Modal = (props: ModalProps) => { const closeModal = () => { props.setModal(false); props.onClose ? props.onClose() : () => {}; }; const width: string = props.size === "xs" ? "w-4/12" : props.size === "rg" ? "w-6/12" : props.size === "lg" ? "w-9/12" : props.size === "xl" ? "w-full" : "w-auto"; const position: string = props.position === "top" ? "content-start justify-items-center" : props.position === "center" ? "place-items-center" : props.position === "bottom" ? "content-end justify-items-center" : "place-items-center"; return ( <>
{props.title}
{props.children}
); }; Modal.defaultProps = { size: "rg", position: "center", closeButton: "Close", continueButton: "Continue", }; export default Modal;