@@ -19,10 +19,19 @@ import { maps } from "./utils"
19
19
import { forwardRef , useEffect , useState } from "react"
20
20
21
21
const animateContainer = {
22
- hidden : { x : - 20 , opacity : 0 } ,
22
+ hidden : {
23
+ x : - 20 ,
24
+ opacity : 0 ,
25
+ transition : {
26
+ staggerChildren : 0.2 ,
27
+ } ,
28
+ } ,
23
29
show : {
24
30
x : 0 ,
25
31
opacity : 1 ,
32
+ transition : {
33
+ staggerChildren : 0.1 ,
34
+ } ,
26
35
} ,
27
36
}
28
37
@@ -89,11 +98,11 @@ const Main = () => {
89
98
/>
90
99
{ screen === "brb" ? (
91
100
< motion . div
92
- key = "brb"
93
- layout = "position"
94
- initial = { { translateX : - 20 , opacity : 0 } }
95
- animate = { { translateX : 0 , opacity : 1 } }
96
- exit = { { translateX : 20 , opacity : 0 } }
101
+ variants = { animateContainer }
102
+ key = { screen }
103
+ initial = "hidden"
104
+ animate = "show"
105
+ exit = "hidden"
97
106
className = "flex flex-col gap-8 w-full items-center"
98
107
>
99
108
< BreakSections
@@ -104,6 +113,7 @@ const Main = () => {
104
113
) : (
105
114
< motion . div
106
115
variants = { animateContainer }
116
+ key = { screen }
107
117
initial = "hidden"
108
118
animate = "show"
109
119
exit = "hidden"
@@ -131,9 +141,7 @@ const Main = () => {
131
141
) }
132
142
{ mapWinners ?. [ i ] && (
133
143
< div className = "absolute inset-0 flex items-center justify-center p-8 text-center text-4xl font-medium" >
134
- < AnimatedText key = { mapWinners [ i ] } >
135
- { mapWinners [ i ] }
136
- </ AnimatedText >
144
+ < FadeText key = { mapWinners [ i ] } > { mapWinners [ i ] } </ FadeText >
137
145
</ div >
138
146
) }
139
147
</ div >
@@ -213,11 +221,17 @@ const BottomSection = ({ comms }) => (
213
221
const BottomComms = ( { block } ) =>
214
222
block . value . map ( ( comm ) => (
215
223
< div className = "flex items-center gap-4" >
216
- < div className = "text-4xl font-medium" > { comm . name } </ div >
224
+ < div className = "text-4xl font-medium" >
225
+ < FadeText > { comm . name } </ FadeText >
226
+ </ div >
217
227
< div className = "self-stretch shrink-0 rounded-full w-1 bg-fabl-indigo-light" > </ div >
218
- < div className = "text-fabl-pink font-semibold" > { comm . pronouns } </ div >
228
+ < div className = "text-fabl-pink font-semibold" >
229
+ < FadeText > { comm . pronouns } </ FadeText >
230
+ </ div >
219
231
< div className = "self-stretch shrink-0 rounded-full w-1 bg-fabl-indigo-light" > </ div >
220
- < div > { comm . twitter } </ div >
232
+ < div >
233
+ < FadeText > { comm . twitter } </ FadeText >
234
+ </ div >
221
235
</ div >
222
236
) )
223
237
@@ -279,15 +293,15 @@ const Score = ({ name, score, reverse }) => (
279
293
) }
280
294
>
281
295
< div className = "text-5xl font-semibold" >
282
- < AnimatedText > { name } </ AnimatedText >
296
+ < FadeText > { name } </ FadeText >
283
297
</ div >
284
298
< div className = "text-5xl font-bold w-8 flex justify-center" >
285
- < AnimatedText > { score } </ AnimatedText >
299
+ < FadeText > { score } </ FadeText >
286
300
</ div >
287
301
</ motion . div >
288
302
)
289
303
290
- const AnimatedText = ( { children } ) => (
304
+ const FadeText = ( { children } ) => (
291
305
< AnimatePresence mode = "wait" >
292
306
< motion . span
293
307
key = { children }
@@ -321,7 +335,7 @@ const FlavorText = ({ text }) => {
321
335
exit = { { opacity : 0 } }
322
336
className = "text-5xl font-semibold"
323
337
>
324
- < AnimatedText > { main } </ AnimatedText >
338
+ < FadeText > { main } </ FadeText >
325
339
</ motion . div >
326
340
) }
327
341
{ sub && (
@@ -333,7 +347,7 @@ const FlavorText = ({ text }) => {
333
347
exit = { { opacity : 0 } }
334
348
className = "text-3xl"
335
349
>
336
- < AnimatedText > { sub } </ AnimatedText >
350
+ < FadeText > { sub } </ FadeText >
337
351
</ motion . div >
338
352
) }
339
353
</ AnimatePresence >
@@ -469,7 +483,7 @@ const Commentator = ({ left, right, comm }) => (
469
483
) }
470
484
>
471
485
< div className = "text-4xl font-medium" >
472
- < AnimatedText > { comm . name } </ AnimatedText >
486
+ < FadeText > { comm . name } </ FadeText >
473
487
</ div >
474
488
< div
475
489
className = { clsx (
@@ -478,11 +492,11 @@ const Commentator = ({ left, right, comm }) => (
478
492
) }
479
493
>
480
494
< div >
481
- < AnimatedText > { comm . twitter } </ AnimatedText >
495
+ < FadeText > { comm . twitter } </ FadeText >
482
496
</ div >
483
497
< div className = "self-stretch shrink-0 rounded-full w-1 bg-fabl-indigo-light" > </ div >
484
498
< div className = "text-fabl-pink font-semibold" >
485
- < AnimatedText > { comm . pronouns } </ AnimatedText >
499
+ < FadeText > { comm . pronouns } </ FadeText >
486
500
</ div >
487
501
</ div >
488
502
</ div >
0 commit comments