cookie-consent/examples/next-app/app/providers.jsx
Pdn Technology 9a001197e1
Some checks are pending
CI / test (20) (push) Waiting to run
CI / test (22) (push) Waiting to run
Tema ayarları eklendi
2026-06-20 08:58:11 +03:00

94 lines
2.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
import Link from "next/link";
import {
CookieConsent,
openPreferences,
} from "@pdntechnology/cookie-consent/react";
const labels = {
title: "Çerez tercihleri",
message: "Deneyiminizi iyileştirmek ve site trafiğini analiz etmek için çerez kullanıyoruz.",
policyLink: "Çerez politikası",
accept: "Tümünü kabul et",
reject: "Tümünü reddet",
manage: "Tercihleri yönet",
save: "Tercihleri kaydet",
necessaryTitle: "Zorunlu",
necessaryDescription: "Sitenin temel işlevleri için gereklidir. Her zaman aktiftir.",
analyticsTitle: "Analitik",
analyticsDescription: "Google Analytics (_ga, _gid) ile ziyaretçi trafiğini ölçer.",
marketingTitle: "Pazarlama",
marketingDescription: "Google Ads ve Meta Pixel ile reklam performansını ölçer.",
alwaysOn: "Her zaman açık",
cookiesHeading: "Kullanılan çerezleri gör",
cookieName: "Ad",
cookiePurpose: "Amaç",
cookieDuration: "Süre",
cookieProvider: "Sağlayıcı",
storageError: "Tercihleriniz kaydedilemedi. Lütfen tekrar deneyin.",
};
const cookies = [
{
category: "necessary",
name: "demo_cookie_consent",
purpose: "Çerez tercihlerinizi saklar",
duration: "1 yıl",
provider: "Bu site",
},
{
category: "analytics",
name: "_ga",
purpose: "Ziyaretçi istatistikleri",
duration: "2 yıl",
provider: "Google Analytics",
},
{
category: "analytics",
name: "_gid",
purpose: "Oturum ayırma",
duration: "24 saat",
provider: "Google Analytics",
},
{
category: "marketing",
name: "_fbp",
purpose: "Reklam hedefleme",
duration: "3 ay",
provider: "Meta",
},
];
export function Providers({ children }) {
return (
<>
{children}
<CookieConsent
policyHref="/cerez-politikasi"
LinkComponent={Link}
labels={labels}
cookies={cookies}
theme={{
primary: "#2563eb",
background: "rgba(15, 23, 42, 0.97)",
text: "#f8fafc",
link: "#93c5fd",
accent: "#2563eb",
}}
onConsentError={({ reason }) => {
console.warn("[demo] consent error:", reason);
}}
/>
</>
);
}
export function CookieSettingsButton() {
return (
<button type="button" onClick={openPreferences}>
Çerez ayarları
</button>
);
}