From 8bf350f075315e44c68a3b4c93e151e5fd2d4b11 Mon Sep 17 00:00:00 2001 From: gimenes Date: Sat, 20 May 2023 11:38:55 -0300 Subject: [PATCH 1/4] add pr checklist for hackathon --- .github/pull_request_template.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f90b39cd..962de496 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,3 +9,11 @@ ## Extra info + +## Checklist +- [ ] Estou usando tokens do DaisyUI e Tailwind CSS +- [ ] Fiz alterações **somente** no arquivo destinado a section do meu grupo +- [ ] O componente esta editável no admin da Deco +- [ ] Adicionei link de preview da section do admin da deco no PR +- [ ] Minha section funciona com propriedades padrão +- [ ] Adicionei links das variacoes do figma que fiz no PR \ No newline at end of file From f96186da3ba707617410bb6f4093c7513784eca0 Mon Sep 17 00:00:00 2001 From: gimenes Date: Sat, 20 May 2023 11:39:39 -0300 Subject: [PATCH 2/4] upgrade pull_request_template --- .github/pull_request_template.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 962de496..93250364 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,9 +11,10 @@ ## Checklist + - [ ] Estou usando tokens do DaisyUI e Tailwind CSS - [ ] Fiz alterações **somente** no arquivo destinado a section do meu grupo - [ ] O componente esta editável no admin da Deco - [ ] Adicionei link de preview da section do admin da deco no PR -- [ ] Minha section funciona com propriedades padrão -- [ ] Adicionei links das variacoes do figma que fiz no PR \ No newline at end of file +- [ ] Minha section funciona com propriedades padrão +- [ ] Adicionei links das variacoes do figma que fiz no PR From 18b8cad0df5456ad1da94e8bfe0e68997c93d1aa Mon Sep 17 00:00:00 2001 From: gimenes Date: Sat, 20 May 2023 11:44:23 -0300 Subject: [PATCH 3/4] upgrade pull request template --- .github/pull_request_template.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 93250364..c5b6d8cd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,14 +1,6 @@ -## What is this contribution about? +## Qual a section que voce esta fazendo? - - -## How to test it? - - - -## Extra info - - + ## Checklist From f007b12590311d82dc1ebd605f22b5b840f8983d Mon Sep 17 00:00:00 2001 From: Kaique Soares <57193392+kaique-soares@users.noreply.github.com> Date: Sat, 20 May 2023 18:53:05 -0300 Subject: [PATCH 4/4] feat: add `CookieConsent` component --- .../ui/CookieConsent.TimeMeteBronca.tsx | 138 ++++++++++++++++++ sections/CookieConsent.TimeMeteBronca.tsx | 2 + 2 files changed, 140 insertions(+) create mode 100644 components/ui/CookieConsent.TimeMeteBronca.tsx create mode 100644 sections/CookieConsent.TimeMeteBronca.tsx diff --git a/components/ui/CookieConsent.TimeMeteBronca.tsx b/components/ui/CookieConsent.TimeMeteBronca.tsx new file mode 100644 index 00000000..f83544e1 --- /dev/null +++ b/components/ui/CookieConsent.TimeMeteBronca.tsx @@ -0,0 +1,138 @@ +import Button from "$store/components/ui/Button.tsx"; +import Icon from "$store/components/ui/Icon.tsx"; +import { useId } from "preact/hooks"; + +const script = (id: string) => ` + const callback = () => { + const KEY = 'store-cookie-consent'; + const ACCEPTED = 'accepted'; + const HIDDEN = "translate-y-[200%]"; + + const consent = localStorage.getItem(KEY); + const element = document.getElementById("${id}"); + + if (consent !== ACCEPTED) { + element.querySelector('[data-button-cc-accept]').addEventListener('click', function () { + localStorage.setItem(KEY, ACCEPTED); + element.classList.add(HIDDEN); + }); + element.querySelector('[data-button-cc-close]').addEventListener('click', function () { + element.classList.add(HIDDEN); + }); + element.classList.remove(HIDDEN); + } + }; + + window.addEventListener('scroll', callback, { once: true }); +`; + +const AVAILABLE_SIZES = { + "xs": "w-full sm:max-w-[360px]", + "sm": "max-w-[480px]", + "md": "max-w-[560px]", + "full": "max-w-full", +} as const; + +export type Props = { + title?: string; + description?: string; + policyURL?: string; + policyLinkDescription?: string; + acceptCookieButtonText?: string; + centralize?: boolean; + size?: "xs" | "sm" | "md" | "full"; +} + +function CookieConsent({ + title = "Cookie policy", + description = + "We use third-party cookies order to personalize your experience.", + policyURL = "#", + policyLinkDescription = "Read our cookie policy", + acceptCookieButtonText = "Allow", + centralize = false, + size = "full", +}: Props) { + const id = `cookie-consent-${useId()}`; + + return ( + <> +
+
+
+ + {title} + + +
+

+ {description} +

+ +
+
+