|
| 1 | +'use client' |
| 2 | + |
| 3 | +import { useEffect, useState } from 'react' |
| 4 | + |
| 5 | +export const CookiesConsent = () => { |
| 6 | + const [visible, setVisible] = useState(false) |
| 7 | + |
| 8 | + useEffect(() => { |
| 9 | + const consent = sessionStorage.getItem('cookieConsent') |
| 10 | + if (!consent) setVisible(true) |
| 11 | + }, []) |
| 12 | + |
| 13 | + const handleConsent = (type: 'manage' | 'reject' | 'accept') => { |
| 14 | + sessionStorage.setItem('cookieConsent', type) |
| 15 | + setVisible(false) |
| 16 | + } |
| 17 | + |
| 18 | + if (!visible) return null |
| 19 | + |
| 20 | + return ( |
| 21 | + <div className="fixed inset-x-0 bottom-0 z-52 flex flex-col gap-4 px-4 pt-4 pb-6 backdrop-blur-3xl md:flex-row md:items-center md:justify-between lg:pt-8 lg:pb-8"> |
| 22 | + <div className="mx-auto flex w-full max-w-2xl flex-col gap-6 lg:max-w-7xl lg:flex-row lg:gap-6"> |
| 23 | + <div className="flex max-w-[840px] flex-col gap-2.5"> |
| 24 | + <p |
| 25 | + className="text-sm font-semibold lg:text-base 2xl:text-lg" |
| 26 | + id="cookieConsentTitle" |
| 27 | + > |
| 28 | + Nós usamos cookies |
| 29 | + </p> |
| 30 | + <p className="text-xs lg:text-sm" id="cookieConsentDesc"> |
| 31 | + Utilizamos cookies para ajudar este site a funcionar, compreender a |
| 32 | + utilização do serviço e promover esforços de marketing e trazer |
| 33 | + features exclusivas para nossos usuários. Leia nossos{' '} |
| 34 | + <a |
| 35 | + className="underline underline-offset-2 transition duration-250" |
| 36 | + href="/termos-de-uso" |
| 37 | + > |
| 38 | + Termos de uso |
| 39 | + </a>{' '} |
| 40 | + para saber mais. |
| 41 | + </p> |
| 42 | + </div> |
| 43 | + <div className="flex shrink-0 flex-col gap-2.5 md:flex-row lg:items-center"> |
| 44 | + <button |
| 45 | + className="flex h-8 w-full cursor-pointer items-center justify-center gap-[0.3em] rounded-[2.5rem] border border-white/20 bg-white/40 px-6 py-1 text-sm text-nowrap outline-offset-2 backdrop-blur-md transition duration-300 hover:border-white/50 hover:bg-white/55 focus:border-neutral-600 md:w-auto lg:h-10 lg:py-2 lg:text-base" |
| 46 | + onClick={() => handleConsent('manage')} |
| 47 | + type="button" |
| 48 | + > |
| 49 | + Rejeitar tudo |
| 50 | + </button> |
| 51 | + <button |
| 52 | + className="flex h-8 w-full cursor-pointer items-center justify-center gap-[0.3em] rounded-[2.5rem] border border-white/20 bg-white/40 px-6 py-1 text-sm text-nowrap outline-offset-2 backdrop-blur-md transition duration-300 hover:border-white/50 hover:bg-white/55 focus:border-neutral-600 md:w-auto lg:h-10 lg:py-2 lg:text-base" |
| 53 | + onClick={() => handleConsent('reject')} |
| 54 | + type="button" |
| 55 | + > |
| 56 | + Rejeitar cookies não essenciais |
| 57 | + </button> |
| 58 | + <button |
| 59 | + className="flex h-8 w-full cursor-pointer items-center justify-center gap-[0.3em] rounded-[2.5rem] border border-white/20 bg-white/40 px-6 py-1 text-sm text-nowrap outline-offset-2 backdrop-blur-md transition duration-300 hover:border-white/50 hover:bg-white/55 focus:border-neutral-600 md:w-auto lg:h-10 lg:py-2 lg:text-base" |
| 60 | + onClick={() => handleConsent('accept')} |
| 61 | + type="button" |
| 62 | + > |
| 63 | + Aceitar tudo |
| 64 | + </button> |
| 65 | + </div> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + ) |
| 69 | +} |
0 commit comments