Skip to content

Commit d1fe560

Browse files
committed
Dynamic colors
1 parent ff55404 commit d1fe560

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/components/Product/ProductFilters.component.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,9 @@ const ProductFilters = ({
4646
)
4747
.sort((a, b) => a.name.localeCompare(b.name));
4848

49-
const getColorClass = (slug: string) => {
50-
switch (slug.toLowerCase()) {
51-
case 'blue':
52-
return 'bg-blue-500';
53-
case 'grey':
54-
return 'bg-gray-500';
55-
case 'red':
56-
return 'bg-red-500';
57-
case 'green':
58-
return 'bg-green-500';
59-
default:
60-
return 'bg-gray-100 border border-gray-300';
61-
}
62-
};
63-
6449
const colors = availableColors.map((color) => ({
6550
name: color.name,
66-
class: getColorClass(color.slug)
51+
class: `bg-${color.slug}-500`
6752
}));
6853

6954
const toggleSize = (size: string) => {

0 commit comments

Comments
 (0)