diff --git a/components/product-card.tsx b/components/product-card.tsx new file mode 100644 index 0000000..b02481d --- /dev/null +++ b/components/product-card.tsx @@ -0,0 +1,78 @@ +"use client"; +import { Card, CardContent, CardFooter } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { BlurImage } from "@/components/blur-image"; +import Link from "next/link"; +import { Badge } from "@/components/badge"; + +interface ProductCardProps { + id: string; + name: string; + price: number; + originalPrice?: number; + image: string; + category: string; + isNew?: boolean; + isSale?: boolean; +} + +export function ProductCard({ + id, + name, + price, + originalPrice, + image, + category, + isNew, + isSale, +}: ProductCardProps) { + const discount = originalPrice + ? Math.round(((originalPrice - price) / originalPrice) * 100) + : 0; + + return ( + + +
+ +
+ {isNew && New} + {isSale && discount > 0 && ( + -{discount}% + )} +
+
+ + +

+ {category} +

+ +

+ {name} +

+ +
+ + ${price} + + {originalPrice && ( + + ${originalPrice} + + )} +
+
+ + + +
+ ); +}