From 21d75e1fc5be9b06029543304cc2e49ff8b58607 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Fri, 24 May 2024 16:13:34 -0400 Subject: lume: add events page fed by Events API Signed-off-by: Xe Iaso --- lume/src/_components/EventCard.jsx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lume/src/_components/EventCard.jsx (limited to 'lume/src/_components/EventCard.jsx') diff --git a/lume/src/_components/EventCard.jsx b/lume/src/_components/EventCard.jsx new file mode 100644 index 0000000..62dbcfe --- /dev/null +++ b/lume/src/_components/EventCard.jsx @@ -0,0 +1,34 @@ +const timestampPBtoDate = ({ seconds }) => { + return new Date(seconds * 1000); +}; + +const formatDate = (date) => { + return date.toLocaleDateString('en-US', { + month: 'long', + day: 'numeric', + year: 'numeric', + }); +}; + +// takes within.website.x.mi.Event +export default ({ name, url, start_date, end_date, location, description }) => { + const startDate = formatDate(timestampPBtoDate(start_date)); + const endDate = formatDate(timestampPBtoDate(end_date)); + return ( +
+

+ + {name} 🔗 + +

+
+

+ {location} - {startDate} {start_date.seconds !== end_date.seconds ? `thru ${endDate})}` : ""} +

+

+ {description} +

+
+
+ ); +}; \ No newline at end of file -- cgit v1.2.3