import { Fragment, PropsWithChildren } from 'react'; import { Dialog, Transition } from '@headlessui/react'; export default function Modal({ children, show = false, maxWidth = '2xl', closeable = true, onClose = () => {}, styling = 'def', className = '', }: PropsWithChildren<{ show: boolean; maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl'; closeable?: boolean; onClose: CallableFunction; styling?: 'def' | 'success' | 'error' | 'info' | 'warning'; className?: string; }>) { 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]; const stylingClass = { 'def': 'bg-neutral-white', 'success': 'bg-success-background border-success-border', 'error': 'bg-error-background border-error-border', 'info': 'bg-info-background border-info-border', 'warning': 'bg-warning-background border-warning-border', }[styling]; return (
{children}
); }