"use client" import { useState, useEffect } from "react" import Link from "next/link" const CONSENT_COOKIE = "cookie-consent" const CONSENT_MAX_AGE = 365 * 24 * 60 * 60 // 1 year in seconds function setConsentCookie() { document.cookie = `${CONSENT_COOKIE}=accepted; path=/; max-age=${CONSENT_MAX_AGE}; SameSite=Lax` } function hasConsent(): boolean { if (typeof document === "undefined") return false return document.cookie.includes(`${CONSENT_COOKIE}=accepted`) } export function CookieBanner() { const [isVisible, setIsVisible] = useState(false) useEffect(() => { if (!hasConsent()) { setIsVisible(true) } }, []) const handleAccept = () => { setConsentCookie() setIsVisible(false) } if (!isVisible) return null return (
This site uses a single cookie to store your consent preference. No tracking or analytics cookies are used.{" "} Learn more