"use client"; import React, { useContext, useState } from "react"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import { ChevronLeft, ChevronRight, Award } from "lucide-react"; // Added Award icon import ProductContext from "@/app/contexts/productContext"; import { backendUrl } from "@/utils/axios"; import Image from "next/image"; const ProductGallery = ({ productId }) => { const { products } = useContext(ProductContext); const [currentImageIndex, setCurrentImageIndex] = useState(0); const nextImage = () => { setCurrentImageIndex((prevIndex) => (prevIndex + 1) % productImages.length); }; const prevImage = () => { setCurrentImageIndex( (prevIndex) => (prevIndex - 1 + productImages.length) % productImages.length ); }; const product = products?.find((pr) => pr.id == productId); if (!product) { return null; } const productImages = product?.images?.map((img) => img.image) || []; const hasCertificate = product.certificate && product.certificate !== "NA"; return (
{productImages?.map((src, index) => ( {`Thumbnail setCurrentImageIndex(index)} /> ))}
{/* Certificate Badge */} {hasCertificate && (
Certified
)} {/* Main image with carousel controls */}
Main product

A+ Grade

IRL Certified

Expert Rating

{hasCertificate && (

Certificate Available

)}

Note: Free Shipping on order above $ 300

100% Secured Payment

Authenticity Guaranteed

); }; export default ProductGallery;