From 55aae0165202de28c40c723e403a9ffd67c0f1db Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 29 Apr 2025 14:05:13 -0400 Subject: [PATCH] Update RSVP form with Material-UI components and improved styling --- frontend/src/components/RSVPForm.tsx | 193 ++++++++++++++++----------- 1 file changed, 116 insertions(+), 77 deletions(-) diff --git a/frontend/src/components/RSVPForm.tsx b/frontend/src/components/RSVPForm.tsx index 9da949e..0c653b8 100644 --- a/frontend/src/components/RSVPForm.tsx +++ b/frontend/src/components/RSVPForm.tsx @@ -1,11 +1,24 @@ import React, { useState } from 'react'; import { useParams } from 'react-router-dom'; import axios from 'axios'; +import { + Box, + Paper, + Typography, + TextField, + Button, + FormControl, + InputLabel, + Select, + MenuItem, + SelectChangeEvent, + Container, +} from '@mui/material'; interface RSVPFormData { name: string; - attending: boolean; - bringing_guests: boolean; + attending: string; + bringing_guests: string; guest_count: number; guest_names: string; items_bringing: string; @@ -15,8 +28,8 @@ const RSVPForm: React.FC = () => { const { slug } = useParams<{ slug: string }>(); const [formData, setFormData] = useState({ name: '', - attending: false, - bringing_guests: false, + attending: '', + bringing_guests: '', guest_count: 0, guest_names: '', items_bringing: '' @@ -26,10 +39,18 @@ const RSVPForm: React.FC = () => { const [success, setSuccess] = useState(false); const handleChange = (e: React.ChangeEvent) => { - const { name, value, type } = e.target; + const { name, value } = e.target; setFormData(prev => ({ ...prev, - [name]: type === 'checkbox' ? (e.target as HTMLInputElement).checked : value + [name]: value + })); + }; + + const handleSelectChange = (e: SelectChangeEvent) => { + const { name, value } = e.target; + setFormData(prev => ({ + ...prev, + [name]: value })); }; @@ -50,108 +71,126 @@ const RSVPForm: React.FC = () => { if (success) { return ( -
-

Thank You!

-

Your RSVP has been submitted successfully.

-
+ + + + Thank You! + + + Your RSVP has been submitted successfully. + + + ); } return ( -
-

RSVP Form

- {error &&
{error}
} - -
-
- - + + + RSVP Form + + + {error && ( + + {error} + + )} + + + -
-
-