src/components/nav/NavCompact.astro
---
/**
* NavCompact
* Kleinere hoogte (48px). Geschikt voor app-interfaces of secundaire nav.
*/
interface Props {
logo: string;
links: { label: string; href: string; active?: boolean }[];
cta?: { label: string; href: string };
bg?: 'white' | 'gray' | 'dark';
}
const { logo, links, cta, bg = 'white' } = Astro.props;
---
<header class={`nco nco--${bg}`}>
<nav class="nco-inner">
<a href="/" class="nco-logo">{logo}</a>
<ul class="nco-links">
{links.map(l => (
<li><a href={l.href} class={`nco-link${l.active ? ' nco-link--active' : ''}`}>{l.label}</a></li>
))}
</ul>
{cta && <a href={cta.href} class="nco-cta">{cta.label}</a>}
</nav>
</header>
<style>
.nco { position: sticky; top: 0; z-index: 100; }
.nco--white { background: #fff; border-bottom: 1px solid #f1f5f9; }
.nco--gray { background: #f8fafc; border-bottom: 1px solid #e5e7eb; }
.nco--dark { background: #1e293b; }
.nco-inner { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; height: 48px; gap: 1.5rem; }
.nco-logo { font-weight: 700; font-size: 0.9375rem; letter-spacing: -0.02em; text-decoration: none; }
.nco--white .nco-logo, .nco--gray .nco-logo { color: #0a0a0a; }
.nco--dark .nco-logo { color: #fff; }
.nco-links { list-style: none; padding: 0; margin: 0; display: flex; flex: 1; gap: 0; }
.nco-link { display: block; font-size: 0.8125rem; font-weight: 500; text-decoration: none; padding: 0.3rem 0.625rem; border-radius: 0.3rem; transition: all 0.15s; }
.nco--white .nco-link, .nco--gray .nco-link { color: #6b7280; }
.nco--dark .nco-link { color: rgba(255,255,255,0.65); }
.nco-link:hover, .nco-link--active { color: var(--color-accent,#6366f1) !important; background: rgba(99,102,241,0.08); }
.nco-cta { margin-left: auto; font-size: 0.8125rem; font-weight: 600; padding: 0.375rem 0.875rem; background: var(--color-accent,#6366f1); color: #fff; border-radius: 0.375rem; text-decoration: none; transition: opacity 0.2s; white-space: nowrap; }
.nco-cta:hover { opacity: 0.88; }
@media (max-width: 768px) { .nco-links { display: none; } }
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
logo * | string | — | Merknaam |
links * | { label: string; href: string; active?: boolean }[] | — | Navigatielinks |
cta | { label: string; href: string } | — | CTA knop |
bg | 'white' | 'gray' | 'dark' | 'white' | Achtergrond |
* = verplicht