From f2df7541c08b1a006a381e3ed4c9c4f0f06bd0c9 Mon Sep 17 00:00:00 2001 From: Aditya Thakral Date: Sun, 12 Sep 2021 01:59:10 -0400 Subject: [PATCH] Dynamic permalinks --- components/EventCard.tsx | 14 ++++++-------- components/EventDescriptionCard.tsx | 4 ++-- content/events/2021/fall/BOT.md | 1 - lib/events.ts | 10 ++++++++-- pages/events/[year]/[term]/index.tsx | 1 - 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/components/EventCard.tsx b/components/EventCard.tsx index e9e5eaec..40120970 100644 --- a/components/EventCard.tsx +++ b/components/EventCard.tsx @@ -7,7 +7,7 @@ import { Link } from "./Link"; import styles from "./EventCard.module.css"; -interface BaseProps { +interface EventCardProps { name: string; short: string; date: Date; @@ -15,15 +15,13 @@ interface BaseProps { location: string; poster?: string; registerLink?: string; + permaLink: string; + showDescription?: boolean; children: ReactNode; } -type EventCardProps = - | (BaseProps & { showDescription?: false; link: string }) - | (BaseProps & { showDescription: true; link?: string }); - export function EventCard({ - link, + permaLink, name, date, online, @@ -60,8 +58,8 @@ export function EventCard({

- {!showDescription && link && ( - + {!showDescription && ( + Learn more )} diff --git a/components/EventDescriptionCard.tsx b/components/EventDescriptionCard.tsx index 67fc754a..67dde493 100644 --- a/components/EventDescriptionCard.tsx +++ b/components/EventDescriptionCard.tsx @@ -16,7 +16,7 @@ interface Props { date: Date; poster?: string; registerLink?: string; - permaLink?: string; + permaLink: string; } /** @@ -51,7 +51,7 @@ export function EventDescriptionCard({

{short}

- {permaLink && Learn more} + Learn more