mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-08-01 10:51:29 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import {Event} from 'web/hooks/use-events'
|
|
|
|
import {EventCard} from './event-card'
|
|
|
|
export function EventsList(props: {
|
|
events: Event[]
|
|
title: string
|
|
emptyMessage: string
|
|
onRsvp?: (eventId: string, status: 'going' | 'maybe' | 'not_going') => void
|
|
onCancelRsvp?: (eventId: string) => void
|
|
onCancelEvent?: (eventId: string) => void
|
|
onEdit?: (event: Event) => void
|
|
className?: string
|
|
}) {
|
|
const {events, title, emptyMessage, onRsvp, onCancelRsvp, onCancelEvent, onEdit, className} =
|
|
props
|
|
|
|
return (
|
|
<div className={className}>
|
|
<h2 className="text-xl font-semibold mb-4">{title}</h2>
|
|
{events.length === 0 ? (
|
|
<p className="text-ink-500 italic">{emptyMessage}</p>
|
|
) : (
|
|
<div className="grid gap-4 grid-cols-1">
|
|
{events.map((event) => (
|
|
<EventCard
|
|
key={event.id}
|
|
event={event}
|
|
onRsvp={onRsvp}
|
|
onCancelRsvp={onCancelRsvp}
|
|
onCancelEvent={onCancelEvent}
|
|
onEdit={onEdit}
|
|
/>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|