src/components/nav/NavWithBanner.astro
---
/**
* NavWithBanner
* Aankondigingsbalk bovenaan + standaard navigatie eronder.
*/
interface Props {
bannerText: string;
bannerLink?: { label: string; href: string };
logo: string;
links: { label: string; href: string; active?: boolean }[];
cta?: { label: string; href: string };
bannerBg?: string;
}
const { bannerText, bannerLink, logo, links, cta, bannerBg = '#6366f1' } = Astro.props;
---
<div class="nwb">
<div class="nwb-banner" style={`background:${bannerBg}`}>
<p class="nwb-banner-text">
{bannerText}
{bannerLink && <a href={bannerLink.href} class="nwb-banner-link">{bannerLink.label} →</a>}
</p>
</div>
<header class="nwb-nav">
<nav class="nwb-inner">
<a href="/" class="nwb-logo">{logo}</a>
<ul class="nwb-links">
{links.map(l => (
<li><a href={l.href} class={`nwb-link${l.active ? ' nwb-link--active' : ''}`}>{l.label}</a></li>
))}
</ul>
{cta && <a href={cta.href} class="nwb-cta">{cta.label}</a>}
</nav>
</header>
</div>
<style>
.nwb-banner { padding: 0.5rem 2rem; text-align: center; }
.nwb-banner-text { font-size: 0.8125rem; font-weight: 500; color: #fff; margin: 0; }
.nwb-banner-link { color: rgba(255,255,255,0.9); font-weight: 700; text-decoration: underline; margin-left: 0.5rem; }
.nwb-nav { background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 100; }
.nwb-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; height: 60px; gap: 2rem; }
.nwb-logo { font-weight: 800; font-size: 1.0625rem; color: #0a0a0a; text-decoration: none; letter-spacing: -0.02em; }
.nwb-links { list-style: none; padding: 0; margin: 0; display: flex; flex: 1; gap: 0; }
.nwb-link { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; text-decoration: none; padding: 0.375rem 0.75rem; border-radius: 0.375rem; transition: color 0.15s, background 0.15s; }
.nwb-link:hover, .nwb-link--active { color: var(--color-accent,#6366f1); background: rgba(99,102,241,0.07); }
.nwb-cta { margin-left: auto; font-size: 0.875rem; font-weight: 600; padding: 0.5rem 1.25rem; background: var(--color-accent,#6366f1); color: #fff; border-radius: 0.5rem; text-decoration: none; transition: opacity 0.2s; white-space: nowrap; }
.nwb-cta:hover { opacity: 0.88; }
@media (max-width: 768px) { .nwb-links { display: none; } }
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
bannerText * | string | — | Tekst in aankondigingsbalk |
logo * | string | — | Merknaam |
links * | { label: string; href: string; active?: boolean }[] | — | Navigatielinks |
bannerLink | { label: string; href: string } | — | Link in banner |
cta | { label: string; href: string } | — | CTA knop |
* = verplicht