@@ -2,14 +2,13 @@ import { useEffect, useState } from "react"
2
2
import _ from "lodash"
3
3
import { useRouter } from "next/router"
4
4
import { useTranslation } from "next-i18next"
5
- import { Box , Grid , Heading } from "@chakra-ui/react"
6
5
7
6
import type { CommunityConference , Lang } from "@/lib/types"
8
7
9
- import { Button } from "@/components/Buttons"
10
8
import EventCard from "@/components/EventCard"
11
9
import InfoBanner from "@/components/InfoBanner"
12
- import InlineLink from "@/components/Link"
10
+ import { Button } from "@/components/ui/buttons/Button"
11
+ import Link from "@/components/ui/Link"
13
12
14
13
import { trackCustomEvent } from "@/lib/utils/matomo"
15
14
import { getLocaleTimestamp } from "@/lib/utils/time"
@@ -22,7 +21,6 @@ const UpcomingEventsList = () => {
22
21
const monthsPerLoad = 2
23
22
24
23
const [ monthGroupedEvents , setMonthGroupedEvents ] = useState ( { } )
25
-
26
24
const [ maxRange , setMaxRange ] = useState < number > ( monthsPerLoad )
27
25
28
26
// Create Date object from each YYYY-MM-DD JSON date string
@@ -70,7 +68,6 @@ const UpcomingEventsList = () => {
70
68
}
71
69
} )
72
70
const groupedEvents = _ . groupBy ( formattedEvents , ( { startDate } ) => {
73
- // .replace(/-/g, "/") ==> Fixes Safari Invalid date
74
71
const start = new Date ( startDate . replace ( / - / g, "/" ) )
75
72
const formatYearMonth = new Intl . DateTimeFormat ( locale , {
76
73
month : "short" ,
@@ -80,9 +77,7 @@ const UpcomingEventsList = () => {
80
77
} )
81
78
82
79
setMonthGroupedEvents ( groupedEvents )
83
-
84
- // eslint-disable-next-line react-hooks/exhaustive-deps
85
- } , [ ] )
80
+ } , [ locale ] )
86
81
87
82
const loadMoreEvents = ( ) => {
88
83
setMaxRange ( ( counter ) => {
@@ -101,43 +96,23 @@ const UpcomingEventsList = () => {
101
96
return (
102
97
< InfoBanner emoji = ":information_source:" >
103
98
{ t ( "page-community-upcoming-events-no-events" ) } { " " }
104
- < InlineLink href = "https://github.com/ethereum/ethereum-org-website/blob/dev/src/data/community-events.json" >
99
+ < Link href = "https://github.com/ethereum/ethereum-org-website/blob/dev/src/data/community-events.json" >
105
100
{ t ( "page-community-please-add-to-page" ) }
106
- </ InlineLink >
101
+ </ Link >
107
102
</ InfoBanner >
108
103
)
109
104
}
110
105
111
106
return (
112
- < >
107
+ < div >
113
108
{ Object . keys ( monthGroupedEvents )
114
109
?. slice ( 0 , maxRange )
115
110
?. map ( ( month ) => {
116
111
const events = monthGroupedEvents [ month ]
117
112
return (
118
- < Box key = { `events_in_${ month } ` } >
119
- < Heading
120
- as = "h3"
121
- fontSize = { { base : "xl" , md : "2xl" } }
122
- py = { 8 }
123
- fontWeight = "semibold"
124
- lineHeight = { 1.4 }
125
- >
126
- { month }
127
- </ Heading >
128
- < Grid
129
- width = { { base : "100%" } }
130
- templateColumns = { {
131
- base : "repeat(1,1fr)" ,
132
- md : "repeat(2,1fr)" ,
133
- lg : "repeat(3,1fr)" ,
134
- } }
135
- justifyContent = { "center" }
136
- alignItems = { "center" }
137
- alignSelf = { "center" }
138
- gap = { 5 }
139
- overflow = { "hidden" }
140
- >
113
+ < div key = { `events_in_${ month } ` } >
114
+ < h3 className = "py-8" > { month } </ h3 >
115
+ < div className = "grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3" >
141
116
{ events . map (
142
117
(
143
118
{
@@ -164,32 +139,19 @@ const UpcomingEventsList = () => {
164
139
/>
165
140
)
166
141
) }
167
- </ Grid >
168
- </ Box >
142
+ </ div >
143
+ </ div >
169
144
)
170
145
} ) }
171
146
172
- < Box
173
- width = "100%"
174
- margin = "30px auto"
175
- position = "relative"
176
- padding = "0 10px"
177
- transition = "all 0.4s ease"
178
- > </ Box >
179
147
{ Object . keys ( monthGroupedEvents ) ?. length !== maxRange && (
180
- < Box
181
- display = "flex"
182
- justifyContent = "center"
183
- maxWidth = "620px"
184
- marginTop = "5"
185
- paddingY = "8"
186
- >
148
+ < div className = "flex justify-center py-8" >
187
149
< Button onClick = { loadMoreEvents } >
188
150
{ t ( "page-community-upcoming-events-load-more" ) }
189
151
</ Button >
190
- </ Box >
152
+ </ div >
191
153
) }
192
- </ >
154
+ </ div >
193
155
)
194
156
}
195
157
0 commit comments