From 0ad21aa7022333d4383b1f6f918aa2da5725d85d Mon Sep 17 00:00:00 2001 From: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com> Date: Sat, 26 Aug 2023 21:09:22 -0700 Subject: [PATCH] yeet styler (sorry ronak) --- pages/events.tsx | 51 ++++++++++++++++++++++++++---------------------- utils/index.ts | 13 ------------ 2 files changed, 28 insertions(+), 36 deletions(-) delete mode 100644 utils/index.ts diff --git a/pages/events.tsx b/pages/events.tsx index 7873a0f..e09698e 100644 --- a/pages/events.tsx +++ b/pages/events.tsx @@ -3,9 +3,7 @@ import { useEffect, useState } from "react"; import styles from "@/styles/Events.module.scss"; import CyberSeo from "@/components/CyberSeo"; import AllEvents, { Event } from "@/data/events"; -import { styler } from "@/utils"; -const s = styler(styles); type TEvent = (typeof AllEvents)[0]; type EventCB = (event: Event) => void; @@ -39,14 +37,18 @@ function isEventThisWeek(event: Event, now: Date) { const Event = (showPopup: EventCB) => (event: TEvent, i: number) => ( -
showPopup(event)}> - {event.type} +
showPopup(event)} + > + {event.type} Placeholder Image -
+

{event.name}

-
{event.date.toDateString()}
-
{event.time}
-
{event.location}
+
{event.date.toDateString()}
+
{event.time}
+
{event.location}
); @@ -60,18 +62,21 @@ const EventPopup = ({ close, event }: EventPopupProps) => { const [mounted, setMounted] = useState(false); useEffect(() => setMounted(true), []); return ( -
-
-
-
+
+
+
+
Placeholder Image -
+

{event.name}

-
{event.date.toDateString()}
-
{event.time}
-
{event.location}
-
{event.description}
+
{event.date.toDateString()}
+
{event.time}
+
{event.location}
+
{event.description}
@@ -87,7 +92,7 @@ export default function Events() { const [popup, setPopup] = useState(null as TEvent | null); const [today, setToday] = useState(new Date()); - // reload `today` because page may be accessed at a date later than + // reload "today" because page may be accessed at a date later than // the date nextjs pre-renders this page useEffect(() => setToday(new Date()), []); @@ -106,7 +111,7 @@ export default function Events() { {popup !== null && ( setPopup(null)} /> )} -
+

Events

{/*
{eventTypes.map((type, i) => ( @@ -127,18 +132,18 @@ export default function Events() {
*/} {/* This Week section */} -
+

This Week

-
+
{thisWeek.length === 0 ? "No events this week. Come back later!" : thisWeek.map(Event(setPopup))}
{/* Upcoming section */} -
+

Upcoming

-
+
{upcomingEvents.length === 0 ? "No upcoming events currently scheduled. Come back later!" : upcomingEvents.map(Event(setPopup))} diff --git a/utils/index.ts b/utils/index.ts deleted file mode 100644 index 86a7745..0000000 --- a/utils/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const styler = - (styles: Record) => - (strings: string[], ...keys: Array) => { - const allparts = keys.map((_, i) => [strings[i], keys[i]]); - allparts.push(strings[strings.length - 1]); - return allparts - .flat() - .filter(Boolean) - .join("") - .split(" ") - .map((klass) => styles[klass] ?? klass) - .join(" "); - };