import React, { useEffect } from 'react'; interface ModalProps { title: string; subtitle?: string; onClose: () => void; children: React.ReactNode; footer?: React.ReactNode; size?: 'md' | 'lg' | 'xl'; } const SIZES: Record, string> = { md: 'max-w-md', lg: 'max-w-2xl', xl: 'max-w-4xl', }; export const Modal: React.FC = ({ title, subtitle, onClose, children, footer, size = 'lg', }) => { // Escape schliesst den Dialog - erwartetes Verhalten und schneller als // zum Schliessen-Button zu greifen. useEffect(() => { const onKeyDown = (event: KeyboardEvent) => { if (event.key === 'Escape') onClose(); }; window.addEventListener('keydown', onKeyDown); return () => window.removeEventListener('keydown', onKeyDown); }, [onClose]); return (

{title}

{subtitle &&

{subtitle}

}
{children}
{footer && (
{footer}
)}
); }; interface ConfirmDialogProps { title: string; message: string; confirmLabel?: string; onConfirm: () => void; onCancel: () => void; } export const ConfirmDialog: React.FC = ({ title, message, confirmLabel = 'Loeschen', onConfirm, onCancel, }) => (

{title}

{message}

);