@@ -17,7 +17,29 @@ const PresetFilters = ({
17
17
showMobileSidebar = false ,
18
18
presetFilterCounts,
19
19
} : PresetFiltersProps ) => {
20
- const colors = [ "primary" , "accent-b" , "accent-c" , "accent-a" , "[#BEBF3B]" ]
20
+ const colors = {
21
+ text : [
22
+ "text-primary" ,
23
+ "text-accent-b" ,
24
+ "text-accent-c" ,
25
+ "text-accent-a" ,
26
+ "text-[#BEBF3B]" ,
27
+ ] ,
28
+ border : [
29
+ "border-primary" ,
30
+ "border-accent-b" ,
31
+ "border-accent-c" ,
32
+ "border-accent-a" ,
33
+ "border-[#BEBF3B]" ,
34
+ ] ,
35
+ bg : [
36
+ "bg-primary" ,
37
+ "bg-accent-b" ,
38
+ "bg-accent-c" ,
39
+ "bg-accent-a" ,
40
+ "bg-[#BEBF3B]" ,
41
+ ] ,
42
+ }
21
43
22
44
return (
23
45
< div >
@@ -29,7 +51,7 @@ const PresetFilters = ({
29
51
} `}
30
52
>
31
53
{ presets . map ( ( preset , idx ) => {
32
- const color = colors [ idx ]
54
+ const colorIdx = colors . text [ idx ] ? idx : idx % colors . text . length
33
55
return (
34
56
< div
35
57
key = { idx }
@@ -48,8 +70,9 @@ const PresetFilters = ({
48
70
< div className = "items-top flex gap-2 px-1.5" >
49
71
< div
50
72
className = { cn (
51
- `relative mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded border-2 border-${ color } ` ,
52
- activePresets . includes ( idx ) && `bg-${ color } `
73
+ "relative mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded border-2" ,
74
+ colors . border [ colorIdx ] ,
75
+ activePresets . includes ( idx ) && colors . bg [ colorIdx ]
53
76
) }
54
77
>
55
78
{ activePresets . includes ( idx ) && (
@@ -68,12 +91,17 @@ const PresetFilters = ({
68
91
) }
69
92
</ div >
70
93
< h3
71
- className = { `duration-50 hyphens-auto text-left text-xl text-${ color } transition-all` }
94
+ className = { cn (
95
+ "duration-50 hyphens-auto text-left text-xl transition-all" ,
96
+ colors . text [ colorIdx ]
97
+ ) }
72
98
>
73
99
{ preset . title } { " " }
74
- < span className = "font-normal" >
75
- ({ presetFilterCounts ?. [ idx ] } )
76
- </ span >
100
+ { presetFilterCounts ?. [ idx ] && (
101
+ < span className = "font-normal" >
102
+ ({ presetFilterCounts [ idx ] } )
103
+ </ span >
104
+ ) }
77
105
</ h3 >
78
106
</ div >
79
107
{ ! showMobileSidebar && (
0 commit comments