diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 8c7dba9..3ad1467 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -4,6 +4,7 @@ import "./App.css"; import ScrollToTop from "./components/ScrollToTop"; import Layout from "./components/Layout/Layout"; +import CookieBanner from "./components/CookieBanner"; import ErrorBoundary from "./ErrorBoundary"; const UrlToQr = lazy(() => import("./pages/UrlToQr")); diff --git a/frontend/src/components/CookieBanner.jsx b/frontend/src/components/CookieBanner.jsx new file mode 100644 index 0000000..9acc4ed --- /dev/null +++ b/frontend/src/components/CookieBanner.jsx @@ -0,0 +1,63 @@ +import React, { useEffect, useState } from "react"; +import { Link } from "react-router-dom"; + +function CookieBanner() { + const [visible, setVisible] = useState(false); + + useEffect(() => { + const consent = localStorage.getItem("cookieConsent"); + + if (!consent) { + setVisible(true); + } + }, []); + + const acceptCookies = () => { + localStorage.setItem("cookieConsent", "accepted"); + setVisible(false); + }; + + const rejectCookies = () => { + localStorage.setItem("cookieConsent", "rejected"); + setVisible(false); + }; + + if (!visible) return null; + + return ( +
+

+ 🍪 Cookie Preferences +

+ +

+ We use cookies to improve your experience and remember your preferences. + Read our{" "} + + Cookie Policy + . +

+ +
+ + + +
+
+ ); +} + +export default CookieBanner; \ No newline at end of file