diff --git a/src/components/ProductCard.astro b/src/components/ProductCard.astro index ce7c14a..df5c36a 100644 --- a/src/components/ProductCard.astro +++ b/src/components/ProductCard.astro @@ -20,9 +20,13 @@ const desc = product.beschreibung[lang]; ---
- + {product.bilder && product.bilder.length > 0 ? ( + {name} + ) : ( + + )}
{product.badges.map((b) => ( {badgeLabel[b]} diff --git a/src/pages/ch/produkt/[slug].astro b/src/pages/ch/produkt/[slug].astro index 520b6fc..f83354f 100644 --- a/src/pages/ch/produkt/[slug].astro +++ b/src/pages/ch/produkt/[slug].astro @@ -42,14 +42,22 @@ const felder: [string, string | undefined][] = [
- -
-
-
-
-
+ {product.bilder && product.bilder.length > 0 ? ( + <> + {name} + {product.bilder.length > 1 && ( +
+ {product.bilder.map((bild) => ( + {name} + ))} +
+ )} + + ) : ( + + )}
@@ -118,4 +126,12 @@ const felder: [string, string | undefined][] = [ confirm.style.display = "block"; setTimeout(() => (confirm.style.display = "none"), 2500); }); + + // Klick auf ein Miniaturbild zeigt es groß im Hauptbild an (mehrere Produktfotos). + const heroImg = document.getElementById("product-hero-img") as HTMLImageElement | null; + document.querySelectorAll(".thumb.product-photo").forEach((thumb) => { + thumb.addEventListener("click", () => { + if (heroImg && thumb.dataset.full) heroImg.src = thumb.dataset.full; + }); + }); diff --git a/src/pages/en/produkt/[slug].astro b/src/pages/en/produkt/[slug].astro index 3ad40dd..f83d595 100644 --- a/src/pages/en/produkt/[slug].astro +++ b/src/pages/en/produkt/[slug].astro @@ -42,14 +42,22 @@ const felder: [string, string | undefined][] = [
- -
-
-
-
-
+ {product.bilder && product.bilder.length > 0 ? ( + <> + {name} + {product.bilder.length > 1 && ( +
+ {product.bilder.map((bild) => ( + {name} + ))} +
+ )} + + ) : ( + + )}
@@ -118,4 +126,12 @@ const felder: [string, string | undefined][] = [ confirm.style.display = "block"; setTimeout(() => (confirm.style.display = "none"), 2500); }); + + // Klick auf ein Miniaturbild zeigt es groß im Hauptbild an (mehrere Produktfotos). + const heroImg = document.getElementById("product-hero-img") as HTMLImageElement | null; + document.querySelectorAll(".thumb.product-photo").forEach((thumb) => { + thumb.addEventListener("click", () => { + if (heroImg && thumb.dataset.full) heroImg.src = thumb.dataset.full; + }); + }); diff --git a/src/pages/fr/produkt/[slug].astro b/src/pages/fr/produkt/[slug].astro index e37c0dc..b0c7a99 100644 --- a/src/pages/fr/produkt/[slug].astro +++ b/src/pages/fr/produkt/[slug].astro @@ -42,14 +42,22 @@ const felder: [string, string | undefined][] = [
- -
-
-
-
-
+ {product.bilder && product.bilder.length > 0 ? ( + <> + {name} + {product.bilder.length > 1 && ( +
+ {product.bilder.map((bild) => ( + {name} + ))} +
+ )} + + ) : ( + + )}
@@ -118,4 +126,12 @@ const felder: [string, string | undefined][] = [ confirm.style.display = "block"; setTimeout(() => (confirm.style.display = "none"), 2500); }); + + // Klick auf ein Miniaturbild zeigt es groß im Hauptbild an (mehrere Produktfotos). + const heroImg = document.getElementById("product-hero-img") as HTMLImageElement | null; + document.querySelectorAll(".thumb.product-photo").forEach((thumb) => { + thumb.addEventListener("click", () => { + if (heroImg && thumb.dataset.full) heroImg.src = thumb.dataset.full; + }); + }); diff --git a/src/pages/produkt/[slug].astro b/src/pages/produkt/[slug].astro index d8fe1eb..6b7253f 100644 --- a/src/pages/produkt/[slug].astro +++ b/src/pages/produkt/[slug].astro @@ -42,14 +42,22 @@ const felder: [string, string | undefined][] = [
- -
-
-
-
-
+ {product.bilder && product.bilder.length > 0 ? ( + <> + {name} + {product.bilder.length > 1 && ( +
+ {product.bilder.map((bild) => ( + {name} + ))} +
+ )} + + ) : ( + + )}
@@ -118,4 +126,12 @@ const felder: [string, string | undefined][] = [ confirm.style.display = "block"; setTimeout(() => (confirm.style.display = "none"), 2500); }); + + // Klick auf ein Miniaturbild zeigt es groß im Hauptbild an (mehrere Produktfotos). + const heroImg = document.getElementById("product-hero-img") as HTMLImageElement | null; + document.querySelectorAll(".thumb.product-photo").forEach((thumb) => { + thumb.addEventListener("click", () => { + if (heroImg && thumb.dataset.full) heroImg.src = thumb.dataset.full; + }); + }); diff --git a/src/styles/global.css b/src/styles/global.css index 149630e..fee0365 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -220,6 +220,20 @@ a.card:hover { background-image: repeating-linear-gradient(135deg, rgba(244,241,247,0.03) 0 2px, transparent 2px 14px); } +/* Echtes Produktfoto (von VanVan im Adminbereich hochgeladen) — ersetzt den Platzhalter, sobald + `bilder` am Produkt gesetzt ist. Gleiche Maße/Ecken wie der Platzhalter, damit beim Hochladen + des ersten Fotos nichts im Layout springt. */ +.product-photo { + display: block; + width: 100%; + height: 100%; + object-fit: cover; + border-radius: var(--radius-m); +} +.product-media .product-photo { aspect-ratio: 1 / 1; } +.thumb.product-photo { cursor: pointer; transition: outline-color 0.2s var(--ease); outline: 2px solid transparent; outline-offset: 2px; } +.thumb.product-photo:hover { outline-color: var(--c-accent); } + /* Portrait-Frame — edler Bilderrahmen für Porträtfotos (Startseite, Über die Kreative, ...) */ .portrait-frame { position: relative;