Hawbeez_Studio / frontend /src /ImageLightbox.jsx
sushilideaclan01's picture
Import Hawbeez Creative Studio app
5d54b3c
raw
history blame contribute delete
780 Bytes
import { useEffect } from 'react'
/**
* Full-screen lightbox. Click overlay or press Escape to close.
*/
export default function ImageLightbox({ src, alt = '', onClose }) {
useEffect(() => {
if (!src) return
const handler = (e) => {
if (e.key === 'Escape') onClose?.()
}
window.addEventListener('keydown', handler)
return () => window.removeEventListener('keydown', handler)
}, [src, onClose])
if (!src) return null
return (
<div
className="image-lightbox-overlay"
onClick={onClose}
role="dialog"
aria-modal="true"
aria-label="View full image"
>
<img
src={src}
alt={alt}
className="image-lightbox-img"
onClick={(e) => e.stopPropagation()}
/>
</div>
)
}