import { ReactNode } from "react"; import Modal from "./Modal"; import SlideOverWideEmpty from "../slideOvers/SlideOverWideEmpty"; import DialogSticky from "./DialogSticky"; interface Props { type: "modal" | "slide" | "dialog"; className?: string; children: ReactNode; open: boolean; setOpen: React.Dispatch>; title?: ReactNode; description?: string; size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "full"; padding?: "none" | "sm"; position?: 0 | 1 | 2 | 3 | 4 | 5; buttons?: ReactNode; footer?: ReactNode; overflowHidden?: boolean; closesOnOutsideClick?: boolean; } export default function ModalOrSlide({ type, className, children, open, setOpen, title, description, size = "3xl", padding = "sm", position = 5, buttons, footer, overflowHidden = false, closesOnOutsideClick = true, }: Props) { if (type === "modal") { return ( {children} ); } else if (type === "slide") { return ( setOpen(false)} size={size} position={position} buttons={buttons} > {children} ); } else if (type === "dialog") { return ( setOpen(false)} footer={footer} size={size} buttons={buttons} className={className} overflowHidden={overflowHidden} closesOnOutsideClick={closesOnOutsideClick} > {children} ); } return null; }