| 6 | import { Progress } from "./ui/progress"; |
| 7 | |
| 8 | const Category = ({ category }: CategoryProps) => { |
| 9 | const { |
| 10 | bg, |
| 11 | circleBg, |
| 12 | text: { main, count }, |
| 13 | progress: { bg: progressBg, indicator }, |
| 14 | icon, |
| 15 | } = topCategoryStyles[category.name as keyof typeof topCategoryStyles] || |
| 16 | topCategoryStyles.default; |
| 17 | |
| 18 | return ( |
| 19 | <div className={cn("gap-[18px] flex p-4 rounded-xl", bg)}> |
| 20 | <figure className={cn("flex-center size-10 rounded-full", circleBg)}> |
| 21 | <Image src={icon} width={20} height={20} alt={category.name} /> |
| 22 | </figure> |
| 23 | <div className="flex w-full flex-1 flex-col gap-2"> |
| 24 | <div className="text-14 flex justify-between"> |
| 25 | <h2 className={cn("font-medium", main)}>{category.name}</h2> |
| 26 | <h3 className={cn("font-normal", count)}>{category.count}</h3> |
| 27 | </div> |
| 28 | <Progress |
| 29 | value={(category.count / category.totalCount) * 100} |
| 30 | className={cn("h-2 w-full", progressBg)} |
| 31 | indicatorClassName={cn("h-2 w-full", indicator)} |
| 32 | /> |
| 33 | </div> |
| 34 | </div> |
| 35 | ); |
| 36 | }; |
| 37 | |
| 38 | export default Category; |