Add navigation to RSVP form from event cards

This commit is contained in:
Your Name
2025-04-29 14:01:29 -04:00
parent 72837de000
commit e4e20c5bcf
2 changed files with 15 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ const App: React.FC = () => {
<Routes>
<Route path="/" element={<EventList />} />
<Route path="/create" element={<EventForm />} />
<Route path="/events/:slug" element={<RSVPForm />} />
<Route path="/events/:slug/rsvp" element={<RSVPForm />} />
</Routes>
</div>
</main>

View File

@@ -16,6 +16,7 @@ interface Event {
description: string;
date: string;
location: string;
slug: string;
}
const EventList: React.FC = () => {
@@ -35,6 +36,10 @@ const EventList: React.FC = () => {
}
};
const handleEventClick = (event: Event) => {
navigate(`/events/${event.slug}/rsvp`);
};
return (
<Box>
<Box sx={{ display: 'flex', justifyContent: 'space-between', mb: 4 }}>
@@ -53,7 +58,15 @@ const EventList: React.FC = () => {
<Grid container spacing={3}>
{events.map((event) => (
<Grid item xs={12} key={event.id}>
<Card>
<Card
onClick={() => handleEventClick(event)}
sx={{
cursor: 'pointer',
'&:hover': {
boxShadow: 6,
}
}}
>
<CardContent>
<Typography variant="h5" component="h2">
{event.title}