49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import React, { ReactNode } from "react";
|
|
import styles from "./EventCard.module.css";
|
|
|
|
import { EventSetting } from "./EventSetting";
|
|
import { Image } from "./Image";
|
|
|
|
interface EventCardProps {
|
|
name: string;
|
|
short: string;
|
|
date: Date;
|
|
online: boolean;
|
|
location: string;
|
|
poster?: string;
|
|
registerLink?: string;
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function EventCard({
|
|
name,
|
|
date,
|
|
online,
|
|
location,
|
|
poster,
|
|
registerLink,
|
|
children,
|
|
}: EventCardProps) {
|
|
return (
|
|
<article className={styles.card}>
|
|
<aside>
|
|
{poster && <Image alt={name} src={poster} />}
|
|
{!poster && <div className={styles.spacer}></div>}
|
|
{/* TODO: use the <Button /> component */}
|
|
{registerLink && (
|
|
<button className={styles.registerButton}>
|
|
<a href={registerLink}>Register</a>
|
|
</button>
|
|
)}
|
|
</aside>
|
|
<section className={styles.content}>
|
|
<h2>{name}</h2>
|
|
<h3>
|
|
<EventSetting date={date} online={online} location={location} />
|
|
</h3>
|
|
<div>{children}</div>
|
|
</section>
|
|
</article>
|
|
);
|
|
}
|