File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,9 +50,22 @@ function initGTM() {
5050 document . head . appendChild ( script ) ;
5151}
5252
53- window . addEventListener ( "cookie-consent-changed" , ( event ) => {
54- if ( event . detail === "accepted" ) {
53+ function handleConsentChange ( consent ) {
54+ if ( consent === "accepted" ) {
5555 initGTM ( ) ;
56+ } else if ( window . gtmDidInit ) {
57+ // GTM can't be unloaded once running, so reload to stop it.
58+ window . location . reload ( ) ;
59+ }
60+ }
61+
62+ window . addEventListener ( "cookie-consent-changed" , ( event ) => {
63+ handleConsentChange ( event . detail ) ;
64+ } ) ;
65+ // A choice made in another tab only reaches this one through the storage event.
66+ window . addEventListener ( "storage" , ( event ) => {
67+ if ( event . key === STORAGE_KEY ) {
68+ handleConsentChange ( event . newValue ) ;
5669 }
5770} ) ;
5871
Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ const CookieConsent = () => {
6767 if ( ! consent ) {
6868 setOpen ( true ) ;
6969 }
70+
71+ // Lets the footer's "Cookie Settings" link reopen the banner.
72+ const reopen = ( ) => setOpen ( true ) ;
73+ window . addEventListener ( "open-cookie-settings" , reopen ) ;
74+ return ( ) => window . removeEventListener ( "open-cookie-settings" , reopen ) ;
7075 } , [ ] ) ;
7176
7277 const handleResponse = ( response ) => {
@@ -91,6 +96,14 @@ const CookieConsent = () => {
9196 We use cookies to enhance your browsing experience. By clicking
9297 "Accept", you consent to our use of cookies. Read more in
9398 our{ " " }
99+ < Link
100+ to = "/company/legal/cookie-notice"
101+ target = "_self"
102+ rel = "noopener noreferrer"
103+ >
104+ Cookie Notice
105+ </ Link >
106+ ,{ " " }
94107 < Link
95108 to = "/company/legal/privacy"
96109 target = "_self"
Original file line number Diff line number Diff line change @@ -132,10 +132,18 @@ const FooterWrapper = styled.section`
132132 padding: 0;
133133 li {
134134 display: inline-flex;
135- a {
135+ a, button {
136136 color: #CCCCCC;
137137 }
138- a:hover {
138+ button {
139+ background: none;
140+ border: none;
141+ padding: 0;
142+ font: inherit;
143+ cursor: pointer;
144+ box-shadow: none;
145+ }
146+ a:hover, button:hover {
139147 color: ${ ( props ) => props . theme . secondaryColor } ;
140148 }
141149 }
Original file line number Diff line number Diff line change @@ -391,6 +391,16 @@ const Footer = ({ location }) => {
391391 < li >
392392 < a href = "/company/legal/terms-of-service" > Terms</ a >
393393 </ li >
394+ < li >
395+ < button
396+ type = "button"
397+ onClick = { ( ) =>
398+ window . dispatchEvent ( new Event ( "open-cookie-settings" ) )
399+ }
400+ >
401+ Cookie Settings
402+ </ button >
403+ </ li >
394404 </ ul >
395405 </ div >
396406 </ Row >
You can’t perform that action at this time.
0 commit comments