import { useState } from "react"; import { Star } from "lucide-react"; import { cls } from "@/lib/utils"; import ImageOrVideo from "@/components/ui/ImageOrVideo"; import Button from "@/components/ui/Button"; import Transition from "@/components/ui/Transition"; type ProductVariant = { label: string; options: string[]; selected: string; onChange: (value: string) => void; }; type ProductDetailCardProps = { name: string; price: string; salePrice?: string; images: string[]; description?: string; rating?: number; ribbon?: string; inventoryStatus?: "in-stock" | "out-of-stock"; inventoryQuantity?: number; sku?: string; variants?: ProductVariant[]; quantity?: ProductVariant; onAddToCart?: () => void; onBuyNow?: () => void; }; const ProductDetailCard = ({ name, price, salePrice, images, description, rating = 0, ribbon, inventoryStatus, inventoryQuantity, sku, variants, quantity, onAddToCart, onBuyNow }: ProductDetailCardProps) => { const [selectedImage, setSelectedImage] = useState(0); return (
{images.length > 1 && (
{images.map((src, i) => ( ))}
)}

{name}

{ribbon && {ribbon}}

{salePrice ? ( <> {price} {salePrice} ) : ( price )}

{Array.from({ length: 5 }).map((_, i) => ( ))}
{(inventoryStatus || inventoryQuantity || sku) && (
{inventoryStatus && ( {inventoryStatus === "in-stock" ? "In Stock" : "Out of Stock"} )} {inventoryQuantity && ( {inventoryQuantity} available )} {sku && SKU: {sku}}
)} {description &&

{description}

} {variants && variants.length > 0 && (
{variants.map((variant) => (
))}
)} {quantity && (
)}
); }; export default ProductDetailCard; export type { ProductVariant };