1import Link from "next/link";
2import { DateTime } from "luxon";
3import { DateRange } from "../components/Snippets";
4import { generateDisplayDate, generateRealtimeDate } from "../lib/lib";
5import classNames from "classnames";
7export default function EventPreview({ event, className, big }) {
8 // Event tiles have a 'dark mode' used when their background images are dark and white text is needed for legibility.
9 const grayText = event?.dark ? "text-washedWhite" : "text-wall-400";
10 const blackText = event?.dark ? "text-white" : "text-wall-600";
12 const starts = generateDisplayDate(event.starts, event.timezone);
13 const ends = generateDisplayDate(event.ends, event.timezone);
15 const inFuture = generateRealtimeDate(starts) > DateTime.now();
18 generateRealtimeDate(event.starts) > DateTime.now() && !inFuture;
22 className={`cursor-pointer aspect-w-4 aspect-h-5 md:aspect-w-5 md:aspect-h-4 ${className}`}
26 className={`bg-wall-100 rounded-xl bg-cover bg-center bg-no-repeat `}
27 style={{ backgroundImage: `url(${event.image})` || "" }}
29 <Link href={`/events/${event.slug}`}>
31 className={classNames(
32 "flex flex-col p-6 justify-between items-between h-full relative",
34 "backdrop-brightness-50 rounded-xl": Boolean(
41 className={`grow-1 flex ${
42 big ? "justify-center" : ""
45 <h3 className={`${blackText} mb-2`}>{event.title}</h3>
46 <p className={blackText + " truncate text-sm"}>
51 <div className="absolute p-6 left-0 bottom-0 w-full pr-32">
52 <p className={`${blackText} type-sub mb-1`}>{event.location}</p>
56 className={`${grayText} type-sub`}
60 {inFuture && event.registration_url ? (
61 <div className="absolute right-0 bottom-0 p-6">
63 className="button-sm bg-green-400 text-white"
64 href={event.registration_url}
65 onClick={(e) => e.stopPropagation()}
72 <div className="absolute right-0 bottom-0 p-6">
74 className="button-sm bg-wall-600 text-white"
75 href={`https://www.youtube.com/watch?v=${event.youtube}`}
76 onClick={(e) => e.stopPropagation()}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list