Computer Science Club of the University of Waterloo's website. https://csclub.uwaterloo.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
www-new/components/EventCard.tsx

101 lines
2.2 KiB

import React, { ReactNode } from "react";
import { Button } from "./Button";
import { EventSetting } from "./EventSetting";
import { Image } from "./Image";
import { Link } from "./Link";
import styles from "./EventCard.module.css";
interface EventCardProps {
name: string;
short: string;
startDate: Date;
endDate?: Date;
online: boolean;
location: string;
poster?: string;
registerLink?: string;
permaLink: string;
showDescription?: boolean;
children: ReactNode;
year: number;
term: string;
slug: string;
titleLinked: boolean;
}
export function EventCard({
permaLink,
name,
startDate,
endDate,
online,
location,
poster,
registerLink,
children,
showDescription = false,
year,
term,
slug,
titleLinked,
}: EventCardProps) {
return (
<article className={styles.card}>
{poster && (
<aside>
<Image alt={name} src={poster} />
{registerLink && (
<Button
isLink={true}
href={registerLink}
size="small"
className={`${styles.registerButton} ${styles.registerButtonWithPoster}`}
>
Register
</Button>
)}
</aside>
)}
<section
className={[
styles.content,
showDescription ? styles.mobileShowDescriptionContent : "",
].join(" ")}
>
<h1>
{titleLinked ? (
<Link href={`/events/${year}/${term}/${slug}`}>{name}</Link>
) : (
name
)}
</h1>
<h2>
<EventSetting
startDate={startDate}
endDate={endDate}
online={online}
location={location}
/>
</h2>
{!showDescription && (
<Link href={permaLink}>
<span className={styles.mobileLearnMore}>Learn more</span>
</Link>
)}
<div className={styles.children}>{children}</div>
{!poster && registerLink && (
<Button
isLink={true}
href={registerLink}
size="small"
className={styles.registerButton}
>
Register
</Button>
)}
</section>
</article>
);
}