-
Notifications
You must be signed in to change notification settings - Fork 0
chore: WPB-26190 Add cookie consent banner #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MarianKijewski
wants to merge
6
commits into
main
Choose a base branch
from
chore/WPB-26190_add_cookie_consent_banner
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3a0ddc1
Install cookie consent node module
MarianKijewski 154d8d8
Introduce default cookie banner
MarianKijewski c0d16c7
Move to Layout component swizzle
MarianKijewski dcb8c70
Add a link to display and alter cookie preferences
MarianKijewski cf52b92
Add copy from wire.com adjusted for our use
MarianKijewski 0941db2
Register CookieConsentBanner as client module so it loads on every page
MarianKijewski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,3 +46,7 @@ | |
| width: 1px; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| #cc-main .cm__desc { | ||
| white-space: pre-line; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import CookieConsentBanner from "./cookie_consent"; | ||
|
|
||
| export function onRouteDidUpdate() { | ||
| return CookieConsentBanner | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import { useEffect } from "react"; | ||
|
|
||
| import "vanilla-cookieconsent/dist/cookieconsent.css"; | ||
| import * as CookieConsent from "vanilla-cookieconsent"; | ||
| import { useColorMode } from '@docusaurus/theme-common'; | ||
|
|
||
| export default function CookieConsentBanner() { | ||
| const { colorMode } = useColorMode(); | ||
|
|
||
| useEffect(() => { | ||
| if (colorMode === "dark") | ||
| document.documentElement.classList.add('cc--darkmode'); | ||
|
|
||
| CookieConsent.run({ | ||
| guiOptions: { | ||
| consentModal: { | ||
| layout: "bar inline", | ||
| position: "bottom", | ||
| equalWeightButtons: true, | ||
| flipButtons: false | ||
| }, | ||
| preferencesModal: { | ||
| layout: "box", | ||
| position: "right", | ||
| equalWeightButtons: false, | ||
| flipButtons: false | ||
| } | ||
| }, | ||
| categories: { | ||
| necessary: { | ||
| readOnly: true | ||
| }, | ||
| analytics: {} | ||
| }, | ||
| language: { | ||
| default: "en", | ||
| translations: { | ||
| en: { | ||
| consentModal: { | ||
| description: "This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience and for analytics and metrics about our visitors both on this website and other media. To find out more about the cookies we use, see our Privacy Policy.\n\n" + | ||
| "If you decline, your information won’t be tracked when you visit this website. A single cookie will be used in your browser to remember your preference not to be tracked.", | ||
| acceptAllBtn: "Accept", | ||
| acceptNecessaryBtn: "Decline", | ||
| showPreferencesBtn: "Cookie settings", | ||
| footer: "<a href=\"#link\">Privacy Policy</a>" | ||
| }, | ||
| preferencesModal: { | ||
| title: "About Cookies", | ||
| acceptAllBtn: "Accept All", | ||
| savePreferencesBtn: "Save settings", | ||
| closeIconLabel: "Close modal", | ||
| serviceCounterLabel: "Service|Services", | ||
| sections: [ | ||
| { | ||
| description: "This site uses cookies. We use cookies mainly to improve and analyze your experience on our websites. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change your default settings." | ||
| }, | ||
| { | ||
| title: "Necessary <span class=\"pm__badge\">Always active</span>", | ||
| description: "These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences or filling in forms", | ||
| linkedCategory: "necessary" | ||
| }, | ||
| { | ||
| title: "Analytics", | ||
| description: "These cookies help us to understand how visitors engage with the website. We may use a set of cookies to collect information and report site usage statistics.", | ||
| linkedCategory: "analytics" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| disablePageInteraction: true | ||
| }); | ||
| }, []); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import React from 'react'; | ||
| import Layout from '@theme-original/Layout'; | ||
| import CookieConsentBanner from "../../scripts/cookie_consent"; | ||
| import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
|
||
| export default function LayoutWrapper({children, ...props}) { | ||
| return ( | ||
| <Layout {...props}> | ||
| <BrowserOnly> | ||
| {() => <CookieConsentBanner />} | ||
| </BrowserOnly> | ||
| {children} | ||
| </Layout> | ||
| ); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be updated when Privacy Policy page is there