import { Form } from "@remix-run/react"; import { useEffect, useRef } from "react"; interface FormModalProps { isOpen: boolean; onClose: () => void; title: string; children: React.ReactNode; isSubmitting?: boolean; submitText?: string; onSubmit?: () => void; } export default function FormModal({ isOpen, onClose, title, children, isSubmitting = false, submitText = "Save", onSubmit }: FormModalProps) { const modalRef = useRef(null); useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === "Escape") { onClose(); } }; if (isOpen) { document.addEventListener("keydown", handleEscape); document.body.style.overflow = "hidden"; } return () => { document.removeEventListener("keydown", handleEscape); document.body.style.overflow = "unset"; }; }, [isOpen, onClose]); if (!isOpen) return null; return (
{/* Background overlay */}
{/* Modal panel */}

{title}

{children}
); }