import React, { useEffect, useState } from 'react'; import { createPortal } from 'react-dom'; import { ArrowsInSimple } from '@phosphor-icons/react'; import { motion, AnimatePresence } from 'framer-motion'; const LuxeImageModal = ({ src, alt, onClose }) => { const [dimensions, setDimensions] = useState(null); useEffect(() => { if (src) { document.body.style.overflow = 'hidden'; } else { document.body.style.overflow = ''; } const handleKeyDown = (e) => { if (e.key === 'Escape') { onClose(); } }; if (src) { window.addEventListener('keydown', handleKeyDown); } return () => { document.body.style.overflow = ''; window.removeEventListener('keydown', handleKeyDown); }; }, [src, onClose]); const handleImageLoad = (e) => { setDimensions({ width: e.target.naturalWidth, height: e.target.naturalHeight, }); }; const showAlt = alt && ![ 'Project Detail', 'Enlarged Content', 'Intel Imagery', 'Full size image', ].includes(alt); return createPortal( {src && ( e.stopPropagation()} initial={{ scale: 0.98, opacity: 0, y: 20 }} animate={{ scale: 1, opacity: 1, y: 0 }} exit={{ scale: 0.98, opacity: 0, y: 20 }} transition={{ type: 'spring', damping: 35, stiffness: 200 }} > {/* Header */}
Visual Archive

{showAlt ? alt : 'Selected Specimen'}

{/* Image Container */}
{alt}
{/* Footer */}
Dimension Analysis {dimensions ? `${dimensions.width} x ${dimensions.height} PX` : 'SCANNING...'}
Fezcodex High-Fidelity Viewer
)}
, document.body, ); }; export default LuxeImageModal;