Redesign Modern/Tijdreis, contactformulier via CMS, taalbestanden #17
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,10 @@ describe('Nav', () => {
|
||||
|
||||
it('renders all nav links including the CTA', () => {
|
||||
renderNav();
|
||||
expect(screen.getByText('Pakketten')).toBeInTheDocument();
|
||||
expect(screen.getByText('Werkwijze')).toBeInTheDocument();
|
||||
expect(screen.getByText('Over')).toBeInTheDocument();
|
||||
// desktop bar + (hidden) mobile menu
|
||||
expect(screen.getAllByText('Pakketten')).toHaveLength(2);
|
||||
expect(screen.getAllByText('Werkwijze')).toHaveLength(2);
|
||||
expect(screen.getAllByText('Over')).toHaveLength(2);
|
||||
expect(screen.getByTestId('nav-cta-link')).toHaveTextContent('Start project');
|
||||
});
|
||||
|
||||
@@ -47,20 +48,30 @@ describe('Nav', () => {
|
||||
expect(toggle).toHaveAttribute('aria-pressed', 'true');
|
||||
});
|
||||
|
||||
it('opens and closes the mobile menu via the toggle button', () => {
|
||||
it('opens and closes the animated mobile menu via the toggle button', () => {
|
||||
renderNav();
|
||||
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
||||
const menu = screen.getByTestId('nav-mobile-menu');
|
||||
expect(menu).toHaveAttribute('data-state', 'closed');
|
||||
// Closed: hidden from the tab order and the accessibility tree.
|
||||
expect(menu).toHaveClass('invisible', 'opacity-0');
|
||||
|
||||
const mobileToggle = screen.getByTestId('nav-mobile-toggle');
|
||||
expect(mobileToggle).toHaveAttribute('aria-expanded', 'false');
|
||||
|
||||
fireEvent.click(mobileToggle);
|
||||
expect(mobileToggle).toHaveAttribute('aria-expanded', 'true');
|
||||
const mobileMenu = screen.getByTestId('nav-mobile-menu');
|
||||
expect(mobileMenu).toBeInTheDocument();
|
||||
expect(menu).toHaveAttribute('data-state', 'open');
|
||||
expect(menu).toHaveClass('visible', 'opacity-100');
|
||||
|
||||
fireEvent.click(mobileToggle);
|
||||
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
||||
expect(menu).toHaveAttribute('data-state', 'closed');
|
||||
});
|
||||
|
||||
it('animates opening and closing, but not under reduced motion', () => {
|
||||
renderNav();
|
||||
const menu = screen.getByTestId('nav-mobile-menu');
|
||||
expect(menu).toHaveClass('transition-[opacity,transform,visibility]', 'duration-200');
|
||||
expect(menu).toHaveClass('motion-reduce:transition-none');
|
||||
});
|
||||
|
||||
it('shows the mobile menu as a dark overlay below the bar that does not push the page, and closes on Escape', () => {
|
||||
@@ -69,15 +80,35 @@ describe('Nav', () => {
|
||||
const menu = screen.getByTestId('nav-mobile-menu');
|
||||
expect(menu).toHaveClass('absolute', 'top-full', 'bg-inv');
|
||||
fireEvent.keyDown(document, { key: 'Escape' });
|
||||
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
||||
expect(menu).toHaveAttribute('data-state', 'closed');
|
||||
});
|
||||
|
||||
it('keeps the bar visible while scrolling on small screens only', () => {
|
||||
it('does not repeat the "Start project" button in the mobile menu', () => {
|
||||
renderNav();
|
||||
const menu = screen.getByTestId('nav-mobile-menu');
|
||||
const labels = Array.from(menu.querySelectorAll('a')).map((a) => a.textContent);
|
||||
expect(labels).toEqual(['Over', 'Pakketten', 'Werkwijze']);
|
||||
});
|
||||
|
||||
it('keeps the CTA on one line and switches to the desktop bar at the md breakpoint', () => {
|
||||
renderNav();
|
||||
const cta = screen.getByTestId('nav-cta-link');
|
||||
expect(cta).toHaveClass('whitespace-nowrap');
|
||||
expect(cta.closest('li')).toHaveClass('hidden', 'md:block');
|
||||
expect(screen.getByTestId('nav-mobile-toggle').closest('li')).toHaveClass('md:hidden');
|
||||
});
|
||||
|
||||
it('gives the CTA a clearly visible hover (inverts to black)', () => {
|
||||
renderNav();
|
||||
expect(screen.getByTestId('nav-cta-link')).toHaveClass('hover:bg-inv', 'hover:text-white');
|
||||
});
|
||||
|
||||
it('keeps the bar visible while scrolling below the md breakpoint only', () => {
|
||||
renderNav();
|
||||
expect(screen.getByRole('navigation', { name: 'Hoofdnavigatie' })).toHaveClass(
|
||||
'sticky',
|
||||
'top-0',
|
||||
'sm:static',
|
||||
'md:static',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -85,10 +116,9 @@ describe('Nav', () => {
|
||||
renderNav();
|
||||
fireEvent.click(screen.getByTestId('nav-mobile-toggle'));
|
||||
const mobileMenu = screen.getByTestId('nav-mobile-menu');
|
||||
expect(mobileMenu).toBeInTheDocument();
|
||||
const link = mobileMenu.querySelector('a');
|
||||
expect(link).not.toBeNull();
|
||||
fireEvent.click(link as HTMLAnchorElement);
|
||||
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
||||
expect(mobileMenu).toHaveAttribute('data-state', 'closed');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,7 +36,9 @@ describe('ErrorBoundary', () => {
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('error-boundary-fallback')).toBeInTheDocument();
|
||||
expect(screen.getByText('Er ging iets mis. Probeer de pagina te vernieuwen.')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText('Er ging iets mis. Probeer de pagina te vernieuwen.'),
|
||||
).toBeInTheDocument();
|
||||
|
||||
consoleErrorSpy.mockRestore();
|
||||
});
|
||||
@@ -53,7 +55,9 @@ describe('ErrorBoundary', () => {
|
||||
expect(Sentry.captureException).toHaveBeenCalledTimes(1);
|
||||
expect(Sentry.captureException).toHaveBeenCalledWith(
|
||||
expect.any(Error),
|
||||
expect.objectContaining({ extra: expect.objectContaining({ componentStack: expect.any(String) }) }),
|
||||
expect.objectContaining({
|
||||
extra: expect.objectContaining({ componentStack: expect.any(String) }),
|
||||
}),
|
||||
);
|
||||
|
||||
consoleErrorSpy.mockRestore();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
export type ToggleTone = 'default' | 'onBrand';
|
||||
|
||||
export const TONE_CLASSES: Record<ToggleTone, string> = {
|
||||
default: 'border-line text-text hover:border-accent-line focus-visible:outline-accent',
|
||||
onBrand: 'border-white/70 text-on-brand hover:border-white focus-visible:outline-white',
|
||||
default: 'border-line text-text hover:border-text hover:bg-surface focus-visible:outline-accent',
|
||||
onBrand:
|
||||
'border-white/70 text-on-brand hover:border-white hover:bg-white/15 focus-visible:outline-white',
|
||||
};
|
||||
|
||||
@@ -93,7 +93,7 @@ export function ContactFormView({ client, token, refreshToken }: ContactFormView
|
||||
<button
|
||||
type="button"
|
||||
onClick={form.reset}
|
||||
className="min-h-[44px] bg-text px-[22px] py-[15px] text-[15px] font-bold text-panel"
|
||||
className="min-h-[44px] bg-text px-[22px] py-[15px] text-[15px] font-bold text-panel transition-colors hover:bg-brand hover:text-on-brand"
|
||||
data-testid="contact-reset"
|
||||
>
|
||||
Nog een bericht sturen
|
||||
@@ -149,7 +149,7 @@ export function ContactFormView({ client, token, refreshToken }: ContactFormView
|
||||
<button
|
||||
type="submit"
|
||||
disabled={form.status === 'sending'}
|
||||
className="min-h-[44px] rounded-none bg-brand px-6 py-[18px] text-[17px] font-bold text-on-brand disabled:opacity-70"
|
||||
className="min-h-[44px] rounded-none bg-brand px-6 py-[18px] text-[17px] font-bold text-on-brand transition-colors hover:bg-text hover:text-bg disabled:opacity-70 disabled:hover:bg-brand disabled:hover:text-on-brand"
|
||||
data-testid="contact-submit"
|
||||
>
|
||||
{form.status === 'sending'
|
||||
|
||||
@@ -19,8 +19,8 @@ export function FilterChips({ chips, activeId, onSelect }: FilterChipsProps) {
|
||||
aria-pressed={active}
|
||||
onClick={() => onSelect(chip.id)}
|
||||
data-testid={`package-chip-${chip.id}`}
|
||||
className={`min-h-[44px] border-2 border-text px-5 text-[15px] font-bold ${
|
||||
active ? 'bg-text text-bg' : 'bg-transparent text-text'
|
||||
className={`min-h-[44px] border-2 border-text px-5 text-[15px] font-bold transition-colors ${
|
||||
active ? 'bg-text text-bg' : 'bg-transparent text-text hover:bg-line'
|
||||
}`}
|
||||
>
|
||||
{chip.label}
|
||||
|
||||
@@ -31,14 +31,14 @@ export function Hero() {
|
||||
<a
|
||||
href="#pakketten"
|
||||
onClick={(event) => handleAnchorClick(event, '#pakketten')}
|
||||
className="bg-white px-[26px] py-[17px] text-base font-bold text-[#0e0d0d] no-underline hover:opacity-90"
|
||||
className="bg-white px-[26px] py-[17px] text-base font-bold text-[#0e0d0d] no-underline transition-colors hover:bg-inv hover:text-white"
|
||||
>
|
||||
Bekijk pakketten
|
||||
</a>
|
||||
<a
|
||||
href="#contact"
|
||||
onClick={(event) => handleAnchorClick(event, '#contact')}
|
||||
className="border-2 border-white px-6 py-[15px] text-base font-bold text-white no-underline hover:opacity-90"
|
||||
className="border-2 border-white px-6 py-[15px] text-base font-bold text-white no-underline transition-colors hover:bg-white hover:text-brand"
|
||||
>
|
||||
Plan een gesprek
|
||||
</a>
|
||||
|
||||
@@ -14,7 +14,7 @@ export function MailtoPanel() {
|
||||
</p>
|
||||
<a
|
||||
href={mailtoHref}
|
||||
className="inline-block bg-brand px-6 py-[18px] text-[17px] font-bold text-on-brand no-underline hover:opacity-90"
|
||||
className="inline-block bg-brand px-6 py-[18px] text-[17px] font-bold text-on-brand no-underline transition-colors hover:bg-text hover:text-bg"
|
||||
data-testid="contact-mailto-button"
|
||||
>
|
||||
Stuur een bericht
|
||||
|
||||
@@ -42,7 +42,7 @@ export function PackageBanner({ pkg, settings }: PackageBannerProps) {
|
||||
}
|
||||
handleAnchorClick(event, '#contact');
|
||||
}}
|
||||
className="bg-white px-[26px] py-[17px] text-base font-bold text-[#0e0d0d] no-underline hover:opacity-90"
|
||||
className="bg-white px-[26px] py-[17px] text-base font-bold text-[#0e0d0d] no-underline transition-colors hover:bg-brand hover:text-on-brand"
|
||||
data-testid="package-banner-cta"
|
||||
>
|
||||
{cta}
|
||||
|
||||
@@ -51,8 +51,10 @@ export function PackageCard({ pkg }: { pkg: PackageCardData }) {
|
||||
select(pkg.slug);
|
||||
handleAnchorClick(event, '#contact');
|
||||
}}
|
||||
className={`block px-5 py-4 text-center text-base font-bold no-underline hover:opacity-90 ${
|
||||
featured ? 'bg-white text-[#0e0d0d]' : 'bg-text text-bg'
|
||||
className={`block px-5 py-4 text-center text-base font-bold no-underline transition-colors ${
|
||||
featured
|
||||
? 'bg-white text-[#0e0d0d] hover:bg-inv hover:text-white'
|
||||
: 'bg-text text-bg hover:bg-brand hover:text-on-brand'
|
||||
}`}
|
||||
data-testid={`package-cta-${pkg.id}`}
|
||||
>
|
||||
|
||||
@@ -58,26 +58,21 @@ export function PackagesSection() {
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{loaded && (
|
||||
<div className="mb-8 flex flex-wrap items-center justify-between gap-x-8 gap-y-4">
|
||||
{filter.chips ? (
|
||||
<FilterChips
|
||||
chips={filter.chips}
|
||||
activeId={filter.activeId}
|
||||
onSelect={filter.setActive}
|
||||
/>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
<p
|
||||
className="text-[15px] text-muted"
|
||||
aria-live="polite"
|
||||
data-testid="packages-status"
|
||||
>
|
||||
{filter.label}
|
||||
</p>
|
||||
{loaded && filter.chips ? (
|
||||
<div className="mb-8">
|
||||
<FilterChips
|
||||
chips={filter.chips}
|
||||
activeId={filter.activeId}
|
||||
onSelect={filter.setActive}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
) : null}
|
||||
{/* Not shown visually; announces the result count to screen readers when a filter changes. */}
|
||||
{loaded ? (
|
||||
<p className="sr-only" aria-live="polite" data-testid="packages-status">
|
||||
{filter.label}
|
||||
</p>
|
||||
) : null}
|
||||
<PackageList packages={filter.visible} loading={!loaded} resetKey={filter.activeId} />
|
||||
{loaded && banner}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user