diff --git a/src/lib/components/ui/ImageLightbox.svelte b/src/lib/components/ui/ImageLightbox.svelte new file mode 100644 index 0000000..4449e44 --- /dev/null +++ b/src/lib/components/ui/ImageLightbox.svelte @@ -0,0 +1,28 @@ + + + + + + +
+ + + e.stopPropagation()} /> +
diff --git a/src/routes/(app)/components/[id]/+page.svelte b/src/routes/(app)/components/[id]/+page.svelte index f8afa58..338c15b 100644 --- a/src/routes/(app)/components/[id]/+page.svelte +++ b/src/routes/(app)/components/[id]/+page.svelte @@ -4,6 +4,9 @@ import { formatDate, timeAgo } from '$lib/utils/date.js'; import ImageUpload from '$lib/components/ui/ImageUpload.svelte'; import DocumentUpload from '$lib/components/ui/DocumentUpload.svelte'; + import ImageLightbox from '$lib/components/ui/ImageLightbox.svelte'; + + let lightboxSrc = $state(null); let { data, form } = $props(); const c = $derived(data.component); @@ -100,7 +103,9 @@
{#each data.images as img}
- {img.caption +
+ +{#if lightboxSrc} + (lightboxSrc = null)} /> +{/if} diff --git a/src/routes/(app)/devices/[id]/+page.svelte b/src/routes/(app)/devices/[id]/+page.svelte index 3a55334..ce689a0 100644 --- a/src/routes/(app)/devices/[id]/+page.svelte +++ b/src/routes/(app)/devices/[id]/+page.svelte @@ -3,6 +3,9 @@ import { DEVICE_CONDITIONS, DEVICE_LOG_TYPES } from '$lib/constants.js'; import ImageUpload from '$lib/components/ui/ImageUpload.svelte'; import DocumentUpload from '$lib/components/ui/DocumentUpload.svelte'; + import ImageLightbox from '$lib/components/ui/ImageLightbox.svelte'; + + let lightboxSrc = $state(null); import { formatDate, timeAgo } from '$lib/utils/date.js'; let { data, form } = $props(); @@ -160,7 +163,9 @@
{#each data.images as img}
- {img.caption + @@ -707,3 +712,7 @@
+ +{#if lightboxSrc} + (lightboxSrc = null)} /> +{/if}