import type { FormEvent } from "react"; import { Button } from "../components/Button"; import { Field } from "../components/Field"; import { Spinner } from "../components/Spinner"; import type { FormErrors, RsvpFormState } from "../hooks/useRsvpForm"; import type { InvitationConfig } from "../types/config"; interface RsvpFormProps { config: InvitationConfig; name: string; setName: (v: string) => void; phone: string; setPhone: (v: string) => void; email: string; setEmail: (v: string) => void; formState: RsvpFormState; errors: FormErrors; onSubmit: () => void; onShowDetails?: () => void; } export function RsvpForm({ config, name, setName, phone, setPhone, email, setEmail, formState, errors, onSubmit, onShowDetails, }: RsvpFormProps) { const isSubmitting = formState === "submitting"; function handleSubmit(e: FormEvent) { e.preventDefault(); if (!isSubmitting) { onSubmit(); } } return (
); }