Duidelijkere hovers, geen zichtbare pakkettenteller, nav schakelt op md met animatie en zonder CTA in mobiel menu

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 16:37:28 +01:00
co-authored by Claude Sonnet 5.5
parent f47528073d
commit 0d7be249f5
11 changed files with 116 additions and 81 deletions
+38 -35
View File
@@ -5,11 +5,13 @@ import { VariantToggle } from '../ui/VariantToggle';
import { handleAnchorClick } from '../../utils/scrollToHash';
/**
* Navigation of design B: part of the brand-red header (not sticky), white text, the CTA as a
* white block. The mobile menu (hamburger) is kept for small screens; years are not in the menu.
* Navigation of design B: part of the brand-red header, white text, the CTA as a white block
* (desktop only). Below the `md` breakpoint a hamburger opens an animated overlay menu with the
* section links; the "Start project" CTA is not repeated there (the hero has its own buttons).
*/
export function Nav() {
const [isMenuOpen, setIsMenuOpen] = useState(false);
const sectionLinks = navLinks.filter((link) => !link.isCta);
// Escape closes the mobile menu (keyboard users).
useEffect(() => {
@@ -27,35 +29,35 @@ export function Nav() {
}
return (
<nav aria-label="Hoofdnavigatie" className="sticky top-0 z-40 bg-brand text-on-brand sm:static">
<div className="mx-auto flex min-h-[84px] max-w-[1280px] items-center justify-between gap-6 px-6 sm:px-8">
<nav aria-label="Hoofdnavigatie" className="sticky top-0 z-40 bg-brand text-on-brand md:static">
<div className="mx-auto flex min-h-[84px] max-w-[1280px] items-center justify-between gap-4 px-6 sm:px-8">
<a
href="#top"
onClick={(event) => handleAnchorClick(event, '#top')}
className="flex items-baseline gap-2 py-2.5 no-underline"
className="flex shrink-0 items-baseline gap-2 py-2.5 no-underline"
>
<span className="text-2xl font-black tracking-tight [font-stretch:125%]">SLP</span>
<span className="text-base font-normal">Software</span>
</a>
<ul className="flex items-center gap-3 sm:gap-8">
<ul className="flex items-center gap-3 md:gap-5 lg:gap-8">
{navLinks.map((link) =>
link.isCta ? (
<li key={link.href} className="hidden sm:block">
<li key={link.href} className="hidden md:block">
<a
href={link.href}
onClick={(event) => handleAnchorClick(event, link.href)}
className="inline-block bg-white px-[18px] py-[11px] text-[15px] font-bold text-brand no-underline hover:opacity-90"
className="inline-block whitespace-nowrap bg-white px-[18px] py-[11px] text-[15px] font-bold text-brand no-underline transition-colors hover:bg-inv hover:text-white"
data-testid="nav-cta-link"
>
{link.label}
</a>
</li>
) : (
<li key={link.href} className="hidden sm:block">
<li key={link.href} className="hidden md:block">
<a
href={link.href}
onClick={(event) => handleAnchorClick(event, link.href)}
className="inline-block py-3 text-[15px] font-medium no-underline hover:opacity-85"
className="inline-block whitespace-nowrap py-3 text-[15px] font-medium no-underline decoration-2 underline-offset-[10px] transition-colors hover:underline"
>
{link.label}
</a>
@@ -68,7 +70,7 @@ export function Nav() {
<li>
<VariantToggle tone="onBrand" />
</li>
<li className="sm:hidden">
<li className="md:hidden">
<button
type="button"
onClick={() => setIsMenuOpen((open) => !open)}
@@ -76,7 +78,7 @@ export function Nav() {
aria-expanded={isMenuOpen}
aria-controls="mobile-nav-menu"
data-testid="nav-mobile-toggle"
className="flex h-11 w-11 items-center justify-center rounded-full border border-white/70 text-on-brand transition-colors hover:border-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
className="flex h-11 w-11 items-center justify-center rounded-full border border-white/70 text-on-brand transition-colors hover:border-white hover:bg-white/15 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
>
<span className="sr-only">{isMenuOpen ? 'Sluit menu' : 'Open menu'}</span>
<svg
@@ -99,29 +101,30 @@ export function Nav() {
</li>
</ul>
</div>
{isMenuOpen ? (
<ul
id="mobile-nav-menu"
data-testid="nav-mobile-menu"
className="absolute inset-x-0 top-full z-40 flex flex-col gap-1 border-t border-white/30 bg-inv px-6 py-3 text-white shadow-[0_12px_24px_rgba(0,0,0,0.35)] sm:hidden"
>
{navLinks.map((link) => (
<li key={link.href}>
<a
href={link.href}
onClick={(event) => handleMobileLinkClick(event, link.href)}
className={
link.isCta
? 'mt-1 block bg-white px-4 py-3 text-[15px] font-bold text-brand no-underline'
: 'block px-1 py-3 text-[15px] font-medium no-underline hover:opacity-85'
}
>
{link.label}
</a>
</li>
))}
</ul>
) : null}
{/* Always mounted so it can animate; `invisible` removes it from the tab order and the
accessibility tree while closed. */}
<ul
id="mobile-nav-menu"
data-testid="nav-mobile-menu"
data-state={isMenuOpen ? 'open' : 'closed'}
className={`absolute inset-x-0 top-full z-40 flex flex-col gap-1 border-t border-white/30 bg-inv px-6 py-3 text-white shadow-[0_12px_24px_rgba(0,0,0,0.35)] transition-[opacity,transform,visibility] duration-200 ease-out motion-reduce:transition-none md:hidden ${
isMenuOpen
? 'visible translate-y-0 opacity-100'
: 'pointer-events-none invisible -translate-y-2 opacity-0'
}`}
>
{sectionLinks.map((link) => (
<li key={link.href}>
<a
href={link.href}
onClick={(event) => handleMobileLinkClick(event, link.href)}
className="block px-1 py-3 text-[15px] font-medium no-underline transition-colors hover:bg-white/10"
>
{link.label}
</a>
</li>
))}
</ul>
</nav>
);
}