"use client";
import { useState } from "react";
import Image from "next/image";
import { ChevronLeft, ChevronRight } from "lucide-react";
interface ImageGalleryProps {
images: string[];
alt: string;
}
export function ImageGallery({ images, alt }: ImageGalleryProps) {
const [activeIndex, setActiveIndex] = useState(0);
const hasImages = images.length > 0;
const handlePrevious = () => {
setActiveIndex((prev) => (prev === 0 ? images.length - 1 : prev - 1));
};
const handleNext = () => {
setActiveIndex((prev) => (prev + 1) % images.length);
};
return (
{hasImages && (
)}
{images.length > 1 && (
<>
{images.map((_, index) => (
>
)}
{images.length > 1 && (
{images.map((image, index) => (
))}
)}
);
}