"use client"; import { useState } from "react"; import Link from "next/link"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Heart, Eye, ShoppingBag, Star } from "lucide-react"; interface ProductCardProps { id: string; name: string; price: number; originalPrice?: number; image: string; images?: string[]; rating: number; reviewCount: number; isNew?: boolean; isSale?: boolean; isWishlisted?: boolean; category: string; colors?: string[]; sizes?: string[]; } export function ProductCard({ id, name, price, originalPrice, image, images = [], rating, reviewCount, isNew = false, isSale = false, isWishlisted = false, category, colors = [], sizes = [], }: ProductCardProps) { const [currentImage, setCurrentImage] = useState(0); const [isHovered, setIsHovered] = useState(false); const [wishlisted, setWishlisted] = useState(isWishlisted); const allImages = [image, ...images]; const discountPercentage = originalPrice ? Math.round(((originalPrice - price) / originalPrice) * 100) : 0; const handleWishlistToggle = (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); setWishlisted(!wishlisted); }; const handleQuickView = (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); // TODO: Implement quick view modal console.log("Quick view for product:", id); }; const handleAddToCart = (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); // TODO: Implement add to cart console.log("Add to cart:", id); }; return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} >
{/* Product Image */}
{/* Placeholder for actual images */}

{name}

{/* Badges */}
{isNew && ( New )} {isSale && ( -{discountPercentage}% )}
{/* Wishlist Button */} {/* Image dots for multiple images */} {allImages.length > 1 && (
{allImages.map((_, index) => (
)} {/* Hover overlay with actions */}
{/* Product Info */} {/* Category */}

{category}

{/* Product Name */}

{name}

{/* Rating */}
{[1, 2, 3, 4, 5].map((star) => ( ))}
({reviewCount})
{/* Colors */} {colors.length > 0 && (
{colors.slice(0, 4).map((color, index) => (
))} {colors.length > 4 && ( +{colors.length - 4} )}
)} {/* Price */}
${price.toFixed(2)} {originalPrice && ( ${originalPrice.toFixed(2)} )}
{/* Sizes */} {sizes.length > 0 && (
{sizes.slice(0, 4).map((size) => ( {size} ))} {sizes.length > 4 && ( +{sizes.length - 4} )}
)}
); }