"use client"; import React, { useState, useEffect } from "react"; import { createPortal } from "react-dom"; interface AgeVerificationModalProps { children: React.ReactNode; } const AgeVerificationModal: React.FC = ({ children }) => { const [showModal, setShowModal] = useState(false); useEffect(() => { const ageVerified = localStorage.getItem("ageVerified"); if (ageVerified !== "true") { setShowModal(true); } }, []); const handleVerify = (isAdult: boolean) => { if (isAdult) { localStorage.setItem("ageVerified", "true"); setShowModal(false); } else { alert("Helaas, je moet 18+ zijn om deze website te bezoeken."); // Optionally redirect or close the tab window.location.href = "about:blank"; // Example: closes the tab or redirects } }; if (!showModal) { return <>{children}; } // Render modal using createPortal to ensure it's at the top level return createPortal(

OEPS, EVEN CHECKEN. PYK is een tikkeltje anders... net als onze check. Stel jezelf de vraag: ben je 18+? Eerlijk antwoord, graag! 😉

, document.body ); }; export default AgeVerificationModal;