src/components/nav/NavTopBar.astro
---
/**
* NavTopBar
* Smalle topbar met contactinfo/links + hoofd navigatie eronder.
*/
interface Props {
logo: string;
topInfo?: string;
topLinks?: { label: string; href: string }[];
mainLinks: { label: string; href: string; active?: boolean }[];
cta?: { label: string; href: string };
}
const { logo, topInfo, topLinks = [], mainLinks, cta } = Astro.props;
---
<div class="ntb">
<div class="ntb-topbar">
<div class="ntb-topbar-inner">
{topInfo && <span class="ntb-info">{topInfo}</span>}
<div class="ntb-toplinks">
{topLinks.map(l => <a href={l.href} class="ntb-toplink">{l.label}</a>)}
</div>
</div>
</div>
<header class="ntb-nav">
<div class="ntb-nav-inner">
<a href="/" class="ntb-logo">{logo}</a>
<ul class="ntb-links">
{mainLinks.map(l => (
<li><a href={l.href} class={`ntb-link${l.active ? ' ntb-link--active' : ''}`}>{l.label}</a></li>
))}
</ul>
{cta && <a href={cta.href} class="ntb-cta">{cta.label}</a>}
</div>
</header>
</div>
<style>
.ntb-topbar { background: #1e293b; }
.ntb-topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0.375rem 2rem; display: flex; align-items: center; justify-content: space-between; }
.ntb-info { font-size: 0.75rem; color: rgba(255,255,255,0.6); }
.ntb-toplinks { display: flex; gap: 1rem; }
.ntb-toplink { font-size: 0.75rem; color: rgba(255,255,255,0.65); text-decoration: none; transition: color 0.15s; }
.ntb-toplink:hover { color: #fff; }
.ntb-nav { background: #fff; border-bottom: 2px solid #f1f5f9; position: sticky; top: 0; z-index: 100; }
.ntb-nav-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; height: 64px; gap: 2rem; }
.ntb-logo { font-weight: 800; font-size: 1.125rem; color: #0a0a0a; text-decoration: none; letter-spacing: -0.02em; }
.ntb-links { list-style: none; padding: 0; margin: 0; display: flex; flex: 1; gap: 0; }
.ntb-link { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; text-decoration: none; padding: 0.375rem 0.875rem; border-radius: 0.375rem; transition: all 0.15s; }
.ntb-link:hover, .ntb-link--active { color: var(--color-accent,#6366f1); background: rgba(99,102,241,0.07); }
.ntb-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; }
.ntb-cta:hover { opacity: 0.88; }
@media (max-width: 768px) { .ntb-topbar { display: none; } .ntb-links { display: none; } }
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
logo * | string | — | Merknaam |
mainLinks * | { label: string; href: string; active?: boolean }[] | — | Hoofdnavigatie |
topInfo | string | — | Info tekst links in topbalk |
topLinks | { label: string; href: string }[] | — | Links rechts in topbalk |
cta | { label: string; href: string } | — | CTA knop |
* = verplicht