|
1 | 1 | import React from "react"; |
| 2 | +import Image from "next/image"; |
2 | 3 | import { Product } from "@/types/product"; |
3 | 4 | import { colours } from "@/styles/colours"; |
4 | 5 |
|
@@ -134,41 +135,71 @@ const BrandTabContent: React.FC<BrandTabContentProps> = ({ |
134 | 135 | <div className="w-full"> |
135 | 136 | <div className="space-y-3"> |
136 | 137 | {[ |
137 | | - { label: 'Price', value: calculateBrandStats.price, color: '#ECCC36' }, |
138 | | - { label: 'Quality', value: calculateBrandStats.quality, color: '#D24330' }, |
139 | | - { label: 'Nutrition', value: calculateBrandStats.nutrition, color: '#3b82f6' }, |
140 | | - { label: 'Sustainability', value: calculateBrandStats.sustainability, color: '#309563' } |
141 | | - ].map((stat, index) => ( |
142 | | - <div key={stat.label} className="flex items-center gap-3"> |
143 | | - <span |
144 | | - className="text-xs font-medium w-20 text-right" |
145 | | - style={{ color: colours.text.secondary }} |
146 | | - > |
147 | | - {stat.label} |
148 | | - </span> |
149 | | - <div className="flex-1 max-w-24"> |
150 | | - <div |
151 | | - className="flex items-center h-4 rounded-full overflow-hidden" |
152 | | - style={{ backgroundColor: colours.content.surfaceSecondary }} |
153 | | - > |
154 | | - <div |
155 | | - className="h-full rounded-full transition-all duration-1000 ease-out opacity-0 animate-fade-in" |
| 138 | + { |
| 139 | + label: 'Price', |
| 140 | + value: calculateBrandStats.price, |
| 141 | + color: '#fef3c7', // yellow-100 |
| 142 | + svg: '/pound-svgrepo-com.svg' |
| 143 | + }, |
| 144 | + { |
| 145 | + label: 'Quality', |
| 146 | + value: calculateBrandStats.quality, |
| 147 | + color: '#fee2e2', // red-100 |
| 148 | + svg: '/quality-supervision-svgrepo-com.svg' |
| 149 | + }, |
| 150 | + { |
| 151 | + label: 'Nutrition', |
| 152 | + value: calculateBrandStats.nutrition, |
| 153 | + color: '#dbeafe', // blue-100 |
| 154 | + svg: '/meal-svgrepo-com.svg' |
| 155 | + }, |
| 156 | + { |
| 157 | + label: 'Sustainability', |
| 158 | + value: calculateBrandStats.sustainability, |
| 159 | + color: '#ecfccb', // lime-100 |
| 160 | + svg: '/leaf-svgrepo-com.svg' |
| 161 | + } |
| 162 | + ].map((stat, index) => { |
| 163 | + const percentage = ((stat.value - 1) / 4) * 100; |
| 164 | + return ( |
| 165 | + <div key={stat.label} className="flex items-center gap-3"> |
| 166 | + <Image |
| 167 | + src={stat.svg} |
| 168 | + alt={stat.label} |
| 169 | + width={16} |
| 170 | + height={16} |
| 171 | + className="flex-shrink-0" |
| 172 | + style={{ color: colours.text.secondary }} |
| 173 | + /> |
| 174 | + <div className="flex-1"> |
| 175 | + <div |
| 176 | + className="relative rounded-lg overflow-hidden" |
156 | 177 | style={{ |
157 | | - width: `${(stat.value / 5) * 100}%`, |
158 | | - backgroundColor: stat.color, |
159 | | - animationDelay: `${0.3 + index * 0.1}s` |
| 178 | + backgroundColor: colours.bargraph.background, |
| 179 | + border: `2px dotted ${colours.card.border}30`, |
| 180 | + height: '28px', |
160 | 181 | }} |
161 | | - /> |
| 182 | + > |
| 183 | + <div |
| 184 | + className="transition-all duration-1000 ease-out absolute inset-0 rounded-lg opacity-0 animate-fade-in" |
| 185 | + style={{ |
| 186 | + width: `${percentage}%`, |
| 187 | + backgroundColor: stat.color, |
| 188 | + border: `2px solid ${colours.card.border}`, |
| 189 | + animationDelay: `${0.3 + index * 0.1}s` |
| 190 | + }} |
| 191 | + /> |
| 192 | + </div> |
162 | 193 | </div> |
| 194 | + <span |
| 195 | + className="text-xs font-medium w-8 text-right flex-shrink-0" |
| 196 | + style={{ color: colours.text.primary }} |
| 197 | + > |
| 198 | + {stat.value.toFixed(1)} |
| 199 | + </span> |
163 | 200 | </div> |
164 | | - <span |
165 | | - className="text-xs font-medium w-8" |
166 | | - style={{ color: colours.text.primary }} |
167 | | - > |
168 | | - {stat.value.toFixed(1)} |
169 | | - </span> |
170 | | - </div> |
171 | | - ))} |
| 201 | + ); |
| 202 | + })} |
172 | 203 | </div> |
173 | 204 | <div |
174 | 205 | className="text-xs mt-3 text-center" |
|
0 commit comments