'use client'; import React, { useState, useEffect } from 'react'; import { X, Maximize2 } from 'lucide-react'; interface LightboxImageProps { src: string; alt: string; position?: string; zoom?: number; className?: string; } export default function LightboxImage({ src, alt, position = "50% 50%", zoom = 1, className = "w-full h-full object-cover" }: LightboxImageProps) { const [isOpen, setIsOpen] = useState(false); // Close on Escape key useEffect(() => { const handleEsc = (e: KeyboardEvent) => { if (e.key === 'Escape') setIsOpen(false); }; window.addEventListener('keydown', handleEsc); return () => window.removeEventListener('keydown', handleEsc); }, []); // Prevent scroll when open useEffect(() => { if (isOpen) { document.body.style.overflow = 'hidden'; } else { document.body.style.overflow = 'unset'; } return () => { document.body.style.overflow = 'unset'; }; }, [isOpen]); return ( <>
{alt}