|
|
|
@ -3,10 +3,11 @@ 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 { |
|
|
|
|
interface BaseProps { |
|
|
|
|
name: string; |
|
|
|
|
short: string; |
|
|
|
|
date: Date; |
|
|
|
@ -17,7 +18,12 @@ interface EventCardProps { |
|
|
|
|
children: ReactNode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type EventCardProps = |
|
|
|
|
| (BaseProps & { showDescription?: false; link: string }) |
|
|
|
|
| (BaseProps & { showDescription: true; link?: string }); |
|
|
|
|
|
|
|
|
|
export function EventCard({ |
|
|
|
|
link, |
|
|
|
|
name, |
|
|
|
|
date, |
|
|
|
|
online, |
|
|
|
@ -25,13 +31,42 @@ export function EventCard({ |
|
|
|
|
poster, |
|
|
|
|
registerLink, |
|
|
|
|
children, |
|
|
|
|
showDescription = false, |
|
|
|
|
}: EventCardProps) { |
|
|
|
|
return ( |
|
|
|
|
<article className={styles.card}> |
|
|
|
|
<aside> |
|
|
|
|
{poster && <Image alt={name} src={poster} />} |
|
|
|
|
{!poster && <div className={styles.spacer}></div>} |
|
|
|
|
{registerLink && ( |
|
|
|
|
{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>{name}</h1> |
|
|
|
|
<h2> |
|
|
|
|
<EventSetting date={date} online={online} location={location} /> |
|
|
|
|
</h2> |
|
|
|
|
{!showDescription && link && ( |
|
|
|
|
<Link href={link}> |
|
|
|
|
<span className={styles.mobileLearnMore}>Learn more</span> |
|
|
|
|
</Link> |
|
|
|
|
)} |
|
|
|
|
<div className={styles.children}>{children}</div> |
|
|
|
|
{!poster && registerLink && ( |
|
|
|
|
<Button |
|
|
|
|
isLink={true} |
|
|
|
|
href={registerLink} |
|
|
|
@ -41,13 +76,6 @@ export function EventCard({ |
|
|
|
|
Register |
|
|
|
|
</Button> |
|
|
|
|
)} |
|
|
|
|
</aside> |
|
|
|
|
<section className={styles.content}> |
|
|
|
|
<h1>{name}</h1> |
|
|
|
|
<h2> |
|
|
|
|
<EventSetting date={date} online={online} location={location} /> |
|
|
|
|
</h2> |
|
|
|
|
<div>{children}</div> |
|
|
|
|
</section> |
|
|
|
|
</article> |
|
|
|
|
); |
|
|
|
|