import { Fragment, PropsWithChildren } from 'react'; import { Dialog, Transition } from '@headlessui/react'; export default function Modal({ children, show = false, maxWidth = '2xl', closeable = true, onClose = () => {}, }: PropsWithChildren<{ show: boolean; maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl'; closeable?: boolean; onClose: CallableFunction; }>) { const close = () => { if (closeable) { onClose(); } }; const maxWidthClass = { sm: 'sm:max-w-sm', md: 'sm:max-w-md', lg: 'sm:max-w-lg', xl: 'sm:max-w-xl', '2xl': 'sm:max-w-2xl', }[maxWidth]; return (
{children}
); }