Files
kunstenkamp/apps/web/src/components/CookieConsent.tsx
zias 37d9a415eb feat:accessibility, new routes, cookie consent, and UI improvements
- Add contact, privacy, and terms pages
- Add CookieConsent component with accept/decline and localStorage
- Add self-hosted DM Sans font with @font-face definitions
- Improve registration form with field validation, blur handlers, and
performer toggle
- Redesign Info section with 'Ongedesemd Brood' hero and FAQ layout
- Remove scroll-snap behavior from all sections
- Add reduced motion support and selection color theming
- Add SVG favicon and SEO meta tags in root layout
- Improve accessibility: aria attributes, semantic HTML, focus styles
- Add link-hover underline animation utility
2026-03-02 20:45:48 +01:00

76 lines
1.9 KiB
TypeScript

"use client";
import { useEffect, useState } from "react";
export function CookieConsent() {
const [isVisible, setIsVisible] = useState(false);
useEffect(() => {
const consent = localStorage.getItem("cookie-consent");
if (!consent) {
setIsVisible(true);
}
}, []);
const acceptCookies = () => {
localStorage.setItem("cookie-consent", "accepted");
setIsVisible(false);
// Enable analytics tracking
if (window.plausible) {
window.plausible("pageview");
}
};
const declineCookies = () => {
localStorage.setItem("cookie-consent", "declined");
setIsVisible(false);
};
if (!isVisible) return null;
return (
<div
role="dialog"
aria-label="Cookie toestemming"
className="fixed right-0 bottom-0 left-0 z-50 border-white/10 border-t bg-[#214e51] p-4 shadow-lg md:p-6"
>
<div className="mx-auto flex max-w-6xl flex-col gap-4 md:flex-row md:items-center md:justify-between">
<div className="flex-1">
<p className="font-['Intro',sans-serif] text-white">
<strong>We gebruiken cookies</strong>
</p>
<p className="mt-1 text-sm text-white/80">
We gebruiken analytische cookies om onze website te verbeteren.
<a href="/privacy" className="underline hover:text-white">
Meer informatie
</a>
</p>
</div>
<div className="flex gap-3">
<button
type="button"
onClick={declineCookies}
className="px-4 py-2 text-sm text-white/80 transition-colors hover:text-white"
>
Weigeren
</button>
<button
type="button"
onClick={acceptCookies}
className="bg-white px-6 py-2 font-['Intro',sans-serif] text-[#214e51] text-sm transition-all hover:scale-105"
>
Accepteren
</button>
</div>
</div>
</div>
);
}
// Add to window type
declare global {
interface Window {
plausible: (event: string, options?: Record<string, unknown>) => void;
}
}