"use client" import { useState } from "react" import Image from "next/image" import { ChevronLeft, ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" import { cn } from "@/lib/utils" interface ProductGalleryProps { images: string[] productName: string } export function ProductGallery({ images, productName }: ProductGalleryProps) { const [selectedIndex, setSelectedIndex] = useState(0) if (!images || images.length === 0) { return (
Görsel Yok
) } const nextImage = () => { setSelectedIndex((prev) => (prev + 1) % images.length) } const prevImage = () => { setSelectedIndex((prev) => (prev - 1 + images.length) % images.length) } return (
{/* Main Image */}
{`${productName} {/* Navigation Buttons (Only if multiple images) */} {images.length > 1 && ( <> )}
{/* Thumbnails */} {images.length > 1 && (
{images.map((img, idx) => ( ))}
)}
) }