mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Clicking outside the lightbox closes it
This commit is contained in:
1 file changed
+8
-2
@@ -21,11 +21,17 @@ export function ImageLightbox({ imageUrl, onClose }: ImageLightboxProps) {
|
||||
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
||||
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
|
||||
)}
|
||||
onPointerDownOutside={onClose}
|
||||
onEscapeKeyDown={onClose}
|
||||
>
|
||||
{imageUrl && (
|
||||
<>
|
||||
{/* Clickable background to close */}
|
||||
<div
|
||||
className="absolute inset-0 cursor-pointer"
|
||||
onClick={onClose}
|
||||
aria-label="Close lightbox"
|
||||
/>
|
||||
|
||||
{/* Close button */}
|
||||
<button
|
||||
onClick={onClose}
|
||||
@@ -36,7 +42,7 @@ export function ImageLightbox({ imageUrl, onClose }: ImageLightboxProps) {
|
||||
</button>
|
||||
|
||||
{/* Image */}
|
||||
<div className="relative w-full h-full flex items-center justify-center">
|
||||
<div className="relative z-[1] flex items-center justify-center max-w-full max-h-full">
|
||||
{imageUrl.startsWith('/') ? (
|
||||
<VFSImage
|
||||
path={imageUrl}
|
||||
|
||||
Reference in new issue
Block a user