-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColorLegends.jsx
More file actions
80 lines (77 loc) · 2.32 KB
/
ColorLegends.jsx
File metadata and controls
80 lines (77 loc) · 2.32 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
import React from 'react';
import colors from '../config/colors';
export const categoryStyles = {
Book: {
backgroundColor: colors['book-alpha-10'],
borderColor: colors['book-alpha-50'],
},
Movie: {
backgroundColor: colors['movie-alpha-10'],
borderColor: colors['movie-alpha-50'],
},
Video: {
backgroundColor: colors['video-alpha-10'],
borderColor: colors['video-alpha-50'],
},
Game: {
backgroundColor: colors['game-alpha-10'],
borderColor: colors['game-alpha-50'],
},
Article: {
backgroundColor: colors['article-alpha-10'],
borderColor: colors['article-alpha-50'],
},
Music: {
backgroundColor: colors['music-alpha-10'],
borderColor: colors['music-alpha-50'],
},
Series: {
backgroundColor: colors['series-alpha-10'],
borderColor: colors['series-alpha-50'],
},
Food: {
backgroundColor: colors['food-alpha-10'],
borderColor: colors['food-alpha-50'],
},
Websites: {
backgroundColor: colors['websites-alpha-10'],
borderColor: colors['websites-alpha-50'],
},
Tools: {
backgroundColor: colors['tools-alpha-10'],
borderColor: colors['tools-alpha-50'],
},
};
const ColorLegends = ({ onLegendClick, hiddenLegends }) => {
return (
<div className="flex justify-center mt-8">
<div className="flex items-center flex-wrap justify-center space-x-4">
{Object.keys(categoryStyles).map((category) => (
<div key={category} className="flex items-center mb-2">
<div
className={`w-4 h-4 rounded-full mr-2 cursor-pointer ${
hiddenLegends.includes(category) ? 'opacity-50' : 'opacity-100'
}`}
style={{
backgroundColor: categoryStyles[category].backgroundColor,
border: `1px solid ${categoryStyles[category].borderColor}`,
}}
onClick={() => onLegendClick(category)}
></div>
<span
className={`cursor-pointer text-white font-light ${
hiddenLegends.includes(category)
? 'opacity-50 line-through'
: 'opacity-100'
}`}
onClick={() => onLegendClick(category)}
>
{category}
</span>
</div>
))}
</div>
</div>
);
};
export default ColorLegends;