Files
Momento/memento-note/components/legal/cookie-consent-banner.tsx
Antigravity a623454347
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m32s
CI / Deploy production (on server) (push) Has been skipped
perf: memo GridCard, fuse save fns, fix slash tab active color
2026-06-14 14:06:05 +00:00

63 lines
2.4 KiB
TypeScript

'use client'
import { useLanguage } from '@/lib/i18n'
import { saveConsentWithSync } from '@/lib/consent/cookie-consent'
interface CookieConsentBannerProps {
onManage: () => void
}
export function CookieConsentBanner({ onManage }: CookieConsentBannerProps) {
const { t } = useLanguage()
return (
<div
role="region"
aria-labelledby="cookie-consent-title"
className="fixed inset-x-0 bottom-0 z-40 border-t border-border bg-memento-paper/95 dark:bg-background/95 backdrop-blur-md px-4 py-4 sm:px-6"
>
<div className="mx-auto flex max-w-5xl flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div className="space-y-1 pe-0 sm:pe-6">
<p
id="cookie-consent-title"
className="text-[10px] font-bold uppercase tracking-[0.25em] text-concrete"
>
{t('consent.banner.title')}
</p>
<p className="text-xs text-ink/80 leading-relaxed max-w-2xl">{t('consent.banner.description')}</p>
</div>
<div className="flex flex-wrap items-center gap-2 shrink-0">
<button
type="button"
onClick={() => saveConsentWithSync(false, false)}
className="px-4 py-2.5 border border-border rounded-xl text-[10px] font-bold uppercase tracking-[0.15em] text-ink hover:bg-white/60 dark:hover:bg-white/5 transition-colors"
>
{t('consent.banner.acceptEssentials')}
</button>
<button
type="button"
onClick={() => saveConsentWithSync(false, false)}
className="px-4 py-2.5 text-[10px] font-bold uppercase tracking-[0.15em] text-concrete hover:text-ink transition-colors"
>
{t('consent.banner.rejectNonEssential')}
</button>
<button
type="button"
onClick={onManage}
className="px-4 py-2.5 text-[10px] font-bold uppercase tracking-[0.15em] text-concrete hover:text-ink underline-offset-2 hover:underline transition-colors"
>
{t('consent.banner.manage')}
</button>
<button
type="button"
onClick={() => saveConsentWithSync(true, false)}
className="px-5 py-2.5 bg-foreground text-background rounded-xl text-[10px] font-bold uppercase tracking-[0.15em] hover:opacity-90 transition-opacity"
>
{t('consent.banner.acceptAll')}
</button>
</div>
</div>
</div>
)
}