From 615f7df4a18c1e96ee983edbe6d6ec0e9a798f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Mon, 13 Jun 2022 18:28:24 +0200 Subject: [PATCH] Force 3/2 format for non landscape photos on Location page Center image on a background when square, portrait or other ratio - Fix MutuationObserver for using components (would think a component is an item) --- src/components/molecules/House.svelte | 5 ++- src/routes/[country]/[location]/[photo].ts | 1 + src/routes/[country]/[location]/index.svelte | 18 +++++------ src/routes/[country]/[location]/index.ts | 23 ++++++++------ src/style/molecules/_house.scss | 33 +++++++++++++++++++- 5 files changed, 58 insertions(+), 22 deletions(-) diff --git a/src/components/molecules/House.svelte b/src/components/molecules/House.svelte index 3ced15b..cc5c756 100644 --- a/src/components/molecules/House.svelte +++ b/src/components/molecules/House.svelte @@ -9,6 +9,7 @@ export let photoAlt: string export let title: string export let index: string + export let orientation: string = undefined export let date: string = undefined export let city: string = undefined @@ -28,7 +29,9 @@

-
+
observerPhotos.observe(item)) + Array.from(mutation.addedNodes) + .filter(item => item.nodeType === Node.ELEMENT_NODE) + .forEach((item: HTMLElement) => observerPhotos.observe(item)) } } }) @@ -269,11 +264,12 @@ {#if photos.length}
- {#each photos as { title, image: { id, title: alt }, slug, city, date_taken }, index} + {#each photos as { title, image: { id, title: alt }, orientation, slug, city, date_taken }, index} { try { const { location } = params @@ -40,15 +53,7 @@ export async function get({ params }: RequestEvent): Promise