feat: add cookie consent banner and functionality to accept cookies

This commit is contained in:
2025-08-04 19:07:48 +05:00
parent 5f23a50795
commit 2acab47351
3 changed files with 83 additions and 5 deletions
+7 -3
View File
@@ -35,8 +35,8 @@ function Info() {
<div className="flex-col max-w-10/12">
<p className="text-white text-base md:text-4xl font-normal">
Организованный Департаментом спорта Москвы и РАФ,
он объединяет фанатов скорости и семьи.
Организованный Департаментом спорта Москвы и РАФ, он объединяет
фанатов скорости и семьи.
</p>
</div>
</div>
@@ -66,7 +66,11 @@ function Info() {
<div className="flex-col md:min-w-2/3 justify-start items-start">
<Button
onClick={() => {
console.log("test");
// open this link in a new tab
const url =
"https://disk.yandex.ru/d/l8yiw1huY5NU9whttps://disk.yandex.ru/d/l8yiw1huY5NU9w";
window.open(url, "_blank", "noopener,noreferrer");
}}
shadowEnabled={false}
variant="blue"
+2 -2
View File
@@ -26,11 +26,11 @@ function Navbar() {
О фестивале
</Link>
</li>
<li>
{/* <li>
<Link href="/about" className="hover:underline">
Карта
</Link>
</li>
</li> */}
<li>
<Link href="/events" className="hover:underline">
соревнования
+74
View File
@@ -47,6 +47,62 @@ export default function Document() {
</div>
</noscript>
{/* Cookie Banner */}
<div
id="cookie-banner"
style={{
position: "fixed",
bottom: 0,
left: 0,
right: 0,
background: "#f0f0f0",
color: "#000",
padding: "15px",
fontSize: "14px",
display: "none",
zIndex: 1000,
boxShadow: "0 -2px 8px rgba(0,0,0,0.1)",
}}
>
<div
style={{
maxWidth: "960px",
margin: "0 auto",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
flexWrap: "wrap",
}}
>
<div style={{ marginRight: "15px" }}>
Мы используем cookie для повышения удобства работы с сайтом.
Подробнее в{" "}
<a
href="https://tech-fest.sport.mos.ru/privacy.html"
target="_blank"
rel="noopener noreferrer"
>
политике конфиденциальности
</a>
.
</div>
<button
id="cookie-accept"
style={{
marginTop: "10px",
padding: "8px 16px",
background: "#eb3333",
color: "white",
border: "none",
cursor: "pointer",
borderRadius: "4px",
}}
>
Хорошо
</button>
</div>
</div>
<div
style={{ display: "none" }}
itemScope
@@ -74,6 +130,24 @@ export default function Document() {
</div>
<Main />
<NextScript />
{/* Cookie Banner Script */}
<script
dangerouslySetInnerHTML={{
__html: `
document.addEventListener("DOMContentLoaded", function () {
if (!localStorage.getItem("cookieAccepted")) {
document.getElementById("cookie-banner").style.display = "block";
}
document.getElementById("cookie-accept").addEventListener("click", function () {
localStorage.setItem("cookieAccepted", "true");
document.getElementById("cookie-banner").style.display = "none";
});
});
`,
}}
/>
</body>
</Html>
);