-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
58 lines (53 loc) · 1.44 KB
/
index.js
File metadata and controls
58 lines (53 loc) · 1.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
// @ts-nocheck
import React, { useState, useEffect } from 'react';
import { shuffle } from 'lodash-es';
import { AnimatedA, AnimatedDiv } from '../Animated';
import {
delay,
spring,
logoAnimation,
logoTransition,
} from './animation.config';
import s from './styles.module.css';
const initialColors = [
['#FF008C', '#FFF0FC'],
['#D309E1', '#A3F9A1'],
['#9C1AFF', '#F1FA0F'],
['#7700FF', '#77E0FF'],
['#FF008D', '#F1FA0F'],
['#D309E2', '#FFF0FC'],
['#9C1AFC', '#F1FA0F'],
['#7700FC', '#77E0FF'],
];
function Products() {
const [colors, setColors] = useState(initialColors);
useEffect(() => {
setTimeout(() => setColors(shuffle(colors)), delay * 10000);
}, [colors]);
return (
<section>
<h2>Pick your next Hog ride</h2>
<div className={s.animated}>
{colors.map(([background, fill], idx) => (
<AnimatedA
whileHover={{ scale: 1.2 }}
key={background}
layoutTransition={spring}
className={`${s.tile} ${s[`moto${idx + 1}`]}`}
style={{ backgroundColor: background, '--logo-color': fill }}
>
<AnimatedDiv
animate={logoAnimation}
className={s.shine}
transition={{
...logoTransition,
delay: Math.random() * 3 * delay,
}}
></AnimatedDiv>
</AnimatedA>
))}
</div>
</section>
);
}
export default Products;