'use client' import { useEffect, useState } from 'react' import type { ImageItem } from '@/types/images' interface LightboxProps { item: ImageItem | null onClose: () => void } function BlobImg({ blob, alt }: { blob: Blob; alt: string }) { const [url, setUrl] = useState(null) useEffect(() => { const u = URL.createObjectURL(blob) setUrl(u) return () => URL.revokeObjectURL(u) }, [blob]) if (!url) return null return {alt} } export function Lightbox({ item, onClose }: LightboxProps) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose() } document.addEventListener('keydown', onKey) return () => document.removeEventListener('keydown', onKey) }, [onClose]) if (!item) return null return (
e.stopPropagation()} >
{item.ref} {item.shopifyProductTitle && ( {item.shopifyProductTitle} )}

Avant

Après

{item.processedBlob ? :

Traitement en cours…

}
) }