-
-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathEventsPage.tsx
More file actions
128 lines (122 loc) · 4.44 KB
/
EventsPage.tsx
File metadata and controls
128 lines (122 loc) · 4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
"use client";
import Heading from "components/common/typography/Heading";
import { useMemo, useState } from "react";
import dayjs from "dayjs";
import { Event as EventType } from "types";
import EventFilterDropDown from "./EventFilterDropDown";
import EventCard from "./EventCard";
import ShapeSection from "components/common/ShapeSection";
import Image from "next/image";
interface EventsPageProps {
events: EventType[];
}
export default function EventsPage({ events }: EventsPageProps) {
const [type, setType] = useState<string | undefined>(undefined);
const filteredEvents = events.filter(
(event) => !type || event.type === type.toLowerCase()
);
const eventsByYear = useMemo(
() =>
filteredEvents.reduce((acc, event) => {
const year = dayjs(event.startDate.date).year().toString();
if (acc[year] === undefined) acc[year] = [event];
else acc[year].push(event);
return acc;
}, {} as Record<string, EventType[]>),
[filteredEvents]
);
const apiConEvent = {
type: "conference",
venue: {
city: "Lille",
},
startDate: {
date: "2026-09-17",
},
endDate: {
date: "2026-09-18",
},
picture: `/images/con/og-2021.png`,
title: "API Platform Conference 2026",
slug: "api-con",
};
return (
<div className="bg-gray-100 dark:bg-blue-black pb-12 relative after:absolute after:w-full after:h-80 after:top-full after:left-0 after:bg-gray-100 after:dark:bg-blue-black">
<ShapeSection
className="bg-blue-black h-[75vh]"
effect="right-triangle"
maskColor="gray-100"
darkModeColor="blue-black"
>
<div className="absolute left-0 top-0 w-full h-full opacity-70 z-0">
<Image
src="/images/events_cover.jpg"
fill
className="w-full h-full object-cover"
alt=""
/>
</div>
<div className="container relative z-10 py-24 text-white flex flex-col justify-center min-h-full">
<Heading size="xl" level="h1" className="pt-8">
Our <strong>events</strong>
</Heading>
<p className="mt-2 font-light text-lg max-w-xl">
International conferences, meetings or even workshops: take a look
at the API Platform community and don't miss any event.
</p>
</div>
</ShapeSection>
<div className="container relative pb-6">
<div className="w-full border-t-[8px] border-t-blue dark:border-t-blue-black mx-auto p-5 -mt-24 text-center bg-white dark:bg-blue-dark shadow-md | md:-mt-12 md:p-0 md:border-t-0 md:text-left md:w-fit md:shadow-none md:bg-transparent dark:md:bg-transparent md:mr-0 md:ml-auto">
<p className="mb-2 font-bold text-sm uppercase">
Filter by event type
</p>
<EventFilterDropDown
value={type}
onChange={setType}
className="border-px border-gray-300 dark:border-blue w-40 mx-auto"
/>
</div>
</div>
<div className="container">
{!type || type.toLowerCase() === "conference" ? (
<div className="mb-12">
<Heading
level="h2"
size="lg"
className="w-full border-b-2 border-b-blue mb-4"
>
API Platform Conference
</Heading>
<div className="grid grid-cols-1 gap-4">
<EventCard
event={apiConEvent}
link="/con"
description="The flagship event dedicated to API Platform and its ecosystem! Get ready for two days of ideas and knowledge-sharing with our incredible lineup of renowned PHP, JavaScript, and API specialists."
/>
</div>
</div>
) : null}
{Object.keys(eventsByYear)
.sort()
.reverse()
.map((year) => (
<div key={year} className="mb-12 last:mb-0">
<Heading
level="h2"
size="lg"
className="w-full border-b-2 border-b-blue mb-4"
>
{year}
</Heading>
<div className="grid grid-cols-1 place-content-center lg:grid-cols-2 gap-4 sm:gap-6">
{eventsByYear[year].map((event: EventType, index: number) => (
<EventCard key={`${event.link}${index}`} event={event} />
))}
</div>
</div>
))}
</div>
</div>
);
}