From 30e01f5f1d9f94373ee1ef6a99a1d47c76d95f32 Mon Sep 17 00:00:00 2001 From: John Riccardi Date: Thu, 9 Apr 2026 16:05:30 -0500 Subject: [PATCH 1/2] Add image lightbox component for blog posts Clicking any article image opens it enlarged in a centered modal overlay. Closes on backdrop click, Escape, close button, or clicking the enlarged image. Includes loading skeleton for large images (e.g. GIFs), respects prefers-reduced-motion, and excludes the hero image via data-no-lightbox. Co-Authored-By: Claude Sonnet 4.6 --- src/components/Lightbox.astro | 225 ++++++++++++++++++++++++++++++++++ src/layouts/BlogPost.astro | 3 + 2 files changed, 228 insertions(+) create mode 100644 src/components/Lightbox.astro diff --git a/src/components/Lightbox.astro b/src/components/Lightbox.astro new file mode 100644 index 0000000..df50c59 --- /dev/null +++ b/src/components/Lightbox.astro @@ -0,0 +1,225 @@ +--- + +--- + + + + + + + + + diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index 33351c0..78deabb 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -8,6 +8,7 @@ import FormattedDate from '@/components/FormattedDate.astro' import { THEME_INIT_SCRIPT } from '@/utils/theme' import { formatReadingTime } from '@/utils/readingTime' import ShareButtons from '@/components/ShareButtons.astro' +import Lightbox from '@/components/Lightbox.astro' type Props = CollectionEntry<'blog'>['data'] & { readingTime?: number @@ -41,6 +42,7 @@ const { title, description, pubDate, updatedDate, heroImage, readingTime } = class="h-full w-full object-cover" width={1020} height={574} + data-no-lightbox /> ) @@ -78,5 +80,6 @@ const { title, description, pubDate, updatedDate, heroImage, readingTime } =