diff --git a/.crafter/scratch/image-lightbox-plan.md b/.crafter/scratch/image-lightbox-plan.md new file mode 100644 index 0000000..5a60db9 --- /dev/null +++ b/.crafter/scratch/image-lightbox-plan.md @@ -0,0 +1,171 @@ +# Image Lightbox — Implementation Plan + +## Feature + +Add click-to-enlarge lightbox to all images in blog posts. Clicking any image opens it in a centered modal overlay. Clicking outside, pressing Escape, or clicking the close button dismisses it. + +## Scope + +- All `` tags inside `
` in blog posts (covers ``, plain markdown images, direct `` components) +- Hero image excluded (already full-width, opt-out via `data-no-lightbox`) +- No external libraries — native `` + vanilla JS + +## Files to Change + +### 1. `src/layouts/BlogPost.astro` + +- Add shared `` element to the end of `` (before ``) +- Add ` 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 } =