'use client'; import React, { useState, useEffect } from 'react'; import Image from 'next/image'; import { motion, AnimatePresence } from 'framer-motion'; import { X, ChevronLeft, ChevronRight, Maximize2, ImageIcon } from 'lucide-react'; import { cn } from '@/lib/utils'; interface GalleryDialogProps { isOpen: boolean; onClose: () => void; images: string[]; vehicleName: string; categoryName: string; } export function GalleryDialog({ isOpen, onClose, images, vehicleName, categoryName }: GalleryDialogProps) { const [currentIndex, setCurrentIndex] = useState(0); const [direction, setDirection] = useState(0); // Lock scroll when open useEffect(() => { if (isOpen) { document.body.style.overflow = 'hidden'; } else { document.body.style.overflow = 'unset'; } return () => { document.body.style.overflow = 'unset'; }; }, [isOpen]); if (!isOpen) return null; const nextImage = () => { setDirection(1); setCurrentIndex((prev) => (prev + 1) % images.length); }; const prevImage = () => { setDirection(-1); setCurrentIndex((prev) => (prev - 1 + images.length) % images.length); }; const variants = { enter: (direction: number) => ({ x: direction > 0 ? 1000 : -1000, opacity: 0, scale: 0.9, }), center: { zIndex: 1, x: 0, opacity: 1, scale: 1, }, exit: (direction: number) => ({ zIndex: 0, x: direction < 0 ? 1000 : -1000, opacity: 0, scale: 0.9, }), }; return ( {isOpen && ( {/* Close Button */} {/* Header Info */}

{categoryName} {vehicleName}

{currentIndex + 1} / {images.length} Kép
{/* Main Stage */}
{images.length > 0 && (
{`${vehicleName} {/* Vignette Overlay - Lighter for object-contain */}
)} {/* Navigation Handles */}
{/* Thumbnails Sidebar/Bottom Bar */}
{images.map((img, idx) => ( ))}
{/* Subtle noise/texture overlay for premium feel */}
)} ); }