NavCentered Navigation
Logo gecentreerd, navigatielinks gesplitst links en rechts. Magazine-stijl.
src/components/nav/NavCentered.astro
---
/**
* NavCentered
* Logo gecentreerd, navigatielinks gesplitst links/rechts. Klassiek magazine-stijl.
*/
interface Props {
logo: string;
links: { label: string; href: string; active?: boolean }[];
cta?: { label: string; href: string };
bg?: 'white' | 'light' | 'dark';
}
const { logo, links, cta, bg = 'white' } = Astro.props;
const half = Math.floor(links.length / 2);
const leftLinks = links.slice(0, half);
const rightLinks = links.slice(half);
const isDark = bg === 'dark';
---
<header class={`nc nc--${bg}`}>
<nav class="nc-inner">
<ul class="nc-links nc-links--left">
{leftLinks.map(l => (
<li><a href={l.href} class={`nc-link${l.active ? ' nc-link--active' : ''}`}>{l.label}</a></li>
))}
</ul>
<a href="/" class="nc-logo">{logo}</a>
<ul class="nc-links nc-links--right">
{rightLinks.map(l => (
<li><a href={l.href} class={`nc-link${l.active ? ' nc-link--active' : ''}`}>{l.label}</a></li>
))}
{cta && <li><a href={cta.href} class="nc-cta">{cta.label}</a></li>}
</ul>
</nav>
</header>
<style>
.nc { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid rgba(0,0,0,0.07); backdrop-filter: blur(12px); }
.nc--white { background: rgba(255,255,255,0.95); }
.nc--light { background: rgba(248,250,252,0.95); }
.nc--dark { background: rgba(10,10,10,0.97); border-bottom-color: rgba(255,255,255,0.08); }
.nc-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 2rem; }
.nc-links { list-style: none; padding: 0; margin: 0; display: flex; align-items: center; gap: 0.25rem; flex: 1; }
.nc-links--right { justify-content: flex-end; }
.nc-link { font-size: 0.875rem; font-weight: 500; text-decoration: none; padding: 0.375rem 0.75rem; border-radius: 0.375rem; transition: background 0.15s, color 0.15s; }
.nc--white .nc-link, .nc--light .nc-link { color: #374151; }
.nc--dark .nc-link { color: rgba(255,255,255,0.7); }
.nc-link:hover, .nc-link--active { background: rgba(99,102,241,0.08); color: var(--color-accent,#6366f1) !important; }
.nc-logo { font-weight: 800; font-size: 1.125rem; text-decoration: none; letter-spacing: -0.02em; white-space: nowrap; }
.nc--white .nc-logo, .nc--light .nc-logo { color: #0a0a0a; }
.nc--dark .nc-logo { color: #fff; }
.nc-cta { font-size: 0.875rem; font-weight: 600; padding: 0.5rem 1.125rem; background: var(--color-accent,#6366f1); color: #fff !important; border-radius: 0.5rem; text-decoration: none; transition: opacity 0.2s; }
.nc-cta:hover { opacity: 0.88; }
@media (max-width: 768px) { .nc-links { display: none; } .nc-inner { justify-content: center; } }
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
logo * | string | — | Merknaam |
links * | { label: string; href: string; active?: boolean }[] | — | Navigatielinks (worden links/rechts gesplitst) |
cta | { label: string; href: string } | — | CTA knop |
bg | 'white' | 'light' | 'dark' | 'white' | Achtergrondkleur |
* = verplicht