Files
palina-theme/partials/lightbox.hbs
Sebastian Krüger dd9bad935e
All checks were successful
Deploy Theme / deploy (push) Successful in 14s
refactor(lightbox): move state to html and use a more robust global click listener
2026-02-19 18:37:46 +01:00

27 lines
1.2 KiB
Handlebars

<div id="lightbox"
x-show="lightboxOpen"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="lightboxOpen = false"
@keydown.escape.window="lightboxOpen = false"
class="fixed inset-0 bg-black/90 z-50 flex items-center justify-center p-4"
x-cloak>
<button @click.stop="lightboxOpen = false"
class="absolute top-6 right-6 text-white/70 hover:text-white transition-colors duration-200 z-50">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-10 h-10">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<div class="relative max-w-7xl max-h-full flex items-center justify-center" @click.stop>
<img :src="lightboxImage"
alt="Lightbox image"
class="max-w-full max-h-[90vh] object-contain shadow-2xl rounded-sm">
</div>
</div>