import type { Event } from "@/common/parser";
import { EventCard } from "./EventCard";

export function EventList({
	events,
	title,
	showDate,
	showLine,
}: {
	events: Event[];
	title?: string;
	showDate?: boolean;
	showLine?: boolean;
}) {
	return (
		<div className="space-y-2 w-full">
			{title && (
				<h2 className="text-2xl font-bold sticky top-16 bg-white dark:bg-black px-8 py-4">
					{title}
				</h2>
			)}
			{events.length === 0 && <p className="text-gray-500 px-8">Žádné události.</p>}
			<div className="flex flex-col gap-2 px-8">
				{events.map((event) => (
					<EventCard
						key={event.id}
						event={event}
						showDate={showDate}
						showLine={showLine}
					/>
				))}
			</div>
		</div>
	);
}
