aktueller stand

This commit is contained in:
torbinus
2026-09-17 16:02:51 +02:00
parent 7e51514383
commit 065cb8b64f
295 changed files with 642342 additions and 1059 deletions
+151 -130
View File
@@ -1,163 +1,184 @@
---
import { sections, COMPANY_NAME, type Section } from "../lib/sections";
import { mainNav, layerTabs, layers, COMPANY_NAME, type Layer } from "../lib/sections";
interface Props {
section: Section;
layer: Layer;
}
const { section } = Astro.props;
const config = sections[section];
const { layer } = Astro.props;
const currentPath = Astro.url.pathname;
/** Ein Punkt der Hauptnavigation gilt als aktiv, auch auf seinen Unterseiten. */
const isCurrent = (href: string) =>
currentPath === href || (href !== "/business" && currentPath.startsWith(`${href}/`));
---
<header class="border-b border-brand-ink/10 bg-white/80 backdrop-blur sticky top-0 z-50">
<div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
<div class="flex h-16 items-center justify-between gap-4">
<a href={config.homeHref} class="flex items-center gap-2 shrink-0">
<img src="/images/place4bees-logo.png" alt="" class="h-10 w-10" />
<span class="font-display text-xl text-brand-ink">{COMPANY_NAME}</span>
<!--
Der Hauptheader. Aufbau wie auf place4bees.com: nur die Biene links, das
Menü rechts, kein Schriftzug — die Wortmarke steht dort erst als Band
unter dem Hero, bei uns im Fuß.
Er schwebt über dem Hero, wie im Original — deshalb `fixed` und nicht
`sticky`. Über dunklen Heros schaltet die Schrift auf Weiß; welche Seite
einen dunklen Hero hat, sagt sie dem Layout über `heroTone`.
Eine Abweichung mit Absicht: er bleibt stehen. Der Live-Header scrollt weg;
mit einem Shop im selben Haus wäre der Warenkorb dann beim Scrollen nicht
mehr erreichbar. Beim Scrollen legt sich deshalb die Glasfläche darunter.
Warenkorb und Konto stehen nicht hier, sondern in der zweiten Leiste der
Shop-Ebene — so bleibt diese Zeile so ruhig wie im Original.
-->
<header id="site-nav" class="fixed inset-x-0 top-0 z-50 py-4 transition-[background-color,box-shadow] duration-200 ease-out">
<div class="scroll-progress" aria-hidden="true"></div>
<div class="mx-auto max-w-[84rem] px-[var(--gutter)]">
<div class="flex h-14 items-center justify-between gap-6">
<a href={layers.site.homeHref} class="group shrink-0" aria-label={`${COMPANY_NAME} Startseite`}>
<img
src="/images/place4bees-biene.png"
alt=""
width="480"
height="480"
class="site-logo h-11 w-auto transition-transform duration-200 ease-out group-hover:-rotate-6 sm:h-12"
/>
</a>
<div class="hidden md:flex items-center gap-1 rounded-full bg-brand-surface p-1">
{Object.entries(sections).map(([key, s]) => (
<div class="hidden xl:flex items-center">
<nav aria-label="Hauptnavigation" class="flex items-center gap-7">
{mainNav.map((item) => {
const active = isCurrent(item.href);
return (
<a
href={item.href}
aria-current={active ? "page" : undefined}
class:list={[
"group relative py-1 text-[1.0625rem] transition-colors duration-200",
active
? "text-[var(--nav-ink-active)]"
: "text-[var(--nav-ink)] hover:text-[var(--nav-ink-active)]",
]}
>
{item.label}
<span
class:list={[
"absolute -bottom-0.5 left-0 h-[1.5px] w-full origin-left bg-[var(--section-accent)] transition-transform duration-200 ease-out",
active ? "scale-x-100" : "scale-x-0 group-hover:scale-x-100",
]}
></span>
</a>
);
})}
</nav>
</div>
{/* Die Reiter öffnen eine Ebene, sie führen nicht auf eine weitere
Seite derselben Art — deshalb sind sie abgesetzt und sehen anders
aus als die Hauptnavigation.
Sie stehen auch dann noch da, wenn die Hauptnavigation längst im
Burger steckt: der Wechsel zwischen Auftritt und Shop ist der eine
Weg, der nie zwei Klicks kosten soll. */}
<div class="ml-auto flex items-center gap-1.5 xl:ml-0 xl:border-l xl:border-[var(--nav-rule)] xl:pl-6">
{layerTabs.map((tab) => (
<a
href={s.homeHref}
class:list={[
"rounded-full px-4 py-1.5 text-sm font-semibold transition-colors",
key === section ? "bg-brand-primary text-brand-ink" : "text-brand-text hover:text-brand-primary",
]}
href={tab.href}
aria-current={layer === tab.layer ? "true" : undefined}
class:list={["layer-tab", layer === tab.layer && "is-active"]}
>
{s.label}
{tab.label}
</a>
))}
</div>
<nav class="hidden md:flex gap-6 items-center">
{config.nav.map((item) => (
<a
href={item.href}
class:list={[
"text-sm font-medium hover:text-brand-primary transition-colors",
currentPath === item.href ? "text-brand-primary" : "text-brand-text",
]}
>
{item.label}
</a>
))}
{section === "private" && (
<a href="/warenkorb" class="relative inline-flex items-center hover:opacity-80 transition-opacity" aria-label="Warenkorb">
<span class="sr-only">Warenkorb</span>
<svg viewBox="0 0 24 24" class="h-7 w-7" aria-hidden="true">
<ellipse cx="12" cy="5.4" rx="6.4" ry="2.1" fill="#8a5a2b" />
<circle cx="12" cy="3.2" r="1.05" fill="#8a5a2b" />
<path d="M5.6 7 C5.6 7 5.1 15 6.6 19 C7.4 21 16.6 21 17.4 19 C18.9 15 18.4 7 18.4 7 Z" fill="#e0a94a" stroke="#a9722a" stroke-width="0.5" />
<rect x="5.8" y="7" width="12.4" height="2.1" rx="1" fill="#c6922f" />
<path d="M12 21 C12 21 13 22.4 12 23.2 C11 22.4 12 21 12 21 Z" fill="#c6922f" />
</svg>
<span
id="cart-badge"
style="display:none"
class="absolute -top-2 -right-2 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-brand-ink px-1 text-xs text-white ring-2 ring-white"
></span>
</a>
)}
</nav>
<button
id="menu-toggle"
class="md:hidden inline-flex items-center justify-center rounded-md p-2 text-brand-text"
class="xl:hidden inline-flex h-10 w-10 items-center justify-center rounded-full text-[var(--nav-ink)] transition-colors hover:bg-brand-surface-sunk"
aria-label="Menü öffnen"
aria-expanded="false"
aria-controls="mobile-menu"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<svg viewBox="0 0 24 24" class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" aria-hidden="true">
<path id="menu-icon-top" d="M3.5 8h17" />
<path id="menu-icon-bottom" d="M3.5 16h17" />
</svg>
</button>
</div>
<nav id="mobile-menu" class="md:hidden hidden pb-4 flex flex-col gap-3">
<div class="flex gap-1 rounded-full bg-brand-surface p-1 mb-2">
{Object.entries(sections).map(([key, s]) => (
<a
href={s.homeHref}
class:list={[
"flex-1 text-center rounded-full px-4 py-1.5 text-sm font-semibold transition-colors",
key === section ? "bg-brand-primary text-brand-ink" : "text-brand-text",
]}
>
{s.label}
</a>
))}
<nav
id="mobile-menu"
aria-label="Hauptnavigation mobil"
class="xl:hidden grid grid-rows-[0fr] transition-[grid-template-rows] duration-400 ease-spring"
>
<div class="overflow-hidden">
<div class="flex flex-col gap-1 pt-5 pb-4">
{mainNav.map((item) => (
<a
href={item.href}
aria-current={isCurrent(item.href) ? "page" : undefined}
class:list={[
"rounded-[var(--radius-inner)] px-3 py-2.5 text-[1.0625rem] transition-colors",
isCurrent(item.href)
? "bg-brand-surface-sunk font-medium text-brand-honey-ink"
: "text-brand-ink hover:text-brand-honey-ink",
]}
>
{item.label}
</a>
))}
</div>
</div>
{config.nav.map((item) => (
<a href={item.href} class="text-sm font-medium text-brand-text hover:text-brand-primary">
{item.label}
</a>
))}
{section === "private" && (
<a href="/warenkorb" class="relative inline-flex items-center gap-2 text-sm font-medium text-brand-text hover:text-brand-primary">
<svg viewBox="0 0 24 24" class="h-6 w-6 shrink-0" aria-hidden="true">
<ellipse cx="12" cy="5.4" rx="6.4" ry="2.1" fill="#8a5a2b" />
<circle cx="12" cy="3.2" r="1.05" fill="#8a5a2b" />
<path d="M5.6 7 C5.6 7 5.1 15 6.6 19 C7.4 21 16.6 21 17.4 19 C18.9 15 18.4 7 18.4 7 Z" fill="#e0a94a" stroke="#a9722a" stroke-width="0.5" />
<rect x="5.8" y="7" width="12.4" height="2.1" rx="1" fill="#c6922f" />
<path d="M12 21 C12 21 13 22.4 12 23.2 C11 22.4 12 21 12 21 Z" fill="#c6922f" />
</svg>
Warenkorb
<span
id="cart-badge-mobile"
style="display:none"
class="inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-brand-ink px-1 text-xs text-white"
></span>
</a>
)}
</nav>
</div>
</header>
<script>
const toggle = document.getElementById("menu-toggle");
const menu = document.getElementById("mobile-menu");
toggle?.addEventListener("click", () => {
const isHidden = menu?.classList.contains("hidden");
menu?.classList.toggle("hidden");
toggle.setAttribute("aria-expanded", String(isHidden));
});
</script>
<script>
import { getCart } from "../lib/cart";
import { getCartIdClient } from "../lib/cartCookie";
async function refreshCartBadge() {
const badges = [
document.getElementById("cart-badge"),
document.getElementById("cart-badge-mobile"),
].filter((el): el is HTMLElement => el != null);
if (badges.length === 0) return;
const cartId = getCartIdClient();
if (!cartId) {
badges.forEach((badge) => (badge.style.display = "none"));
return;
}
try {
const cart = await getCart(cartId);
const count = (cart.items ?? []).reduce((sum, item) => sum + item.quantity, 0);
badges.forEach((badge) => {
if (count > 0) {
badge.textContent = String(count);
badge.style.display = "inline-flex";
} else {
badge.style.display = "none";
}
});
} catch {
badges.forEach((badge) => (badge.style.display = "none"));
}
<style>
/* Glassmorphism with an edge highlight: the 1px inset white line is what
* separates real frosted glass from a plain blurred rectangle. */
/* Glasfläche beim Scrollen — und ebenso, sobald das Mobilmenü offen ist:
* dessen Einträge lägen sonst frei auf dem Hero-Foto. */
#site-nav.is-scrolled,
#site-nav.is-menu-open {
background: rgb(250 248 243 / 0.72);
backdrop-filter: blur(16px) saturate(1.4);
-webkit-backdrop-filter: blur(16px) saturate(1.4);
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.6),
0 1px 0 rgb(231 227 218 / 0.9),
0 12px 28px -18px rgb(26 24 20 / 0.3);
}
refreshCartBadge();
window.addEventListener("cart:updated", refreshCartBadge);
#mobile-menu.is-open {
grid-template-rows: 1fr;
}
</style>
<script>
document.addEventListener("astro:page-load", () => {
const nav = document.getElementById("site-nav");
const sentinel = document.getElementById("scroll-sentinel");
if (nav && sentinel) {
// IntersectionObserver statt scroll-Listener: der Browser meldet nur den
// Zustandswechsel, nicht jeden Frame.
// Kein rootMargin: die Schwelle steckt in der Höhe des Markers.
new IntersectionObserver(([entry]) =>
nav.classList.toggle("is-scrolled", !entry.isIntersecting)
).observe(sentinel);
}
const toggle = document.getElementById("menu-toggle");
const menu = document.getElementById("mobile-menu");
const iconTop = document.getElementById("menu-icon-top");
const iconBottom = document.getElementById("menu-icon-bottom");
toggle?.addEventListener("click", () => {
const open = menu?.classList.toggle("is-open") ?? false;
nav?.classList.toggle("is-menu-open", open);
toggle.setAttribute("aria-expanded", String(open));
toggle.setAttribute("aria-label", open ? "Menü schließen" : "Menü öffnen");
// Morph the two bars into an X rather than swapping icons.
iconTop?.setAttribute("d", open ? "M5.5 5.5l13 13" : "M3.5 8h17");
iconBottom?.setAttribute("d", open ? "M18.5 5.5l-13 13" : "M3.5 16h17");
});
});
</script>