Skip to content
This repository was archived by the owner on Apr 7, 2025. It is now read-only.

Commit 575589b

Browse files
author
Daniel Golden
committed
feat(GDPR): cookie acceptance dialog
- adds component for cookie acceptance - styles it + responsiveness + dark mode - refines buttons styles across the board
1 parent dd56cd3 commit 575589b

File tree

5 files changed

+160
-3
lines changed

5 files changed

+160
-3
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import styles from './CookieApprovalDialog.module.scss';
4+
import withDarkMode from './withDarkMode';
5+
6+
const CookieApprovalDialog = ({ className, darkMode }) => {
7+
return (
8+
<div className={`${styles.container} ${className || ''}`}>
9+
<div className={styles.content}>
10+
{/* <X className={styles.buttonClose} size={18} /> */}
11+
<div className={styles.primaryContent}>
12+
<h4 className={styles.heading}>This site uses cookies 🍪</h4>
13+
<p className={styles.description}>
14+
We rely on cookies to play videos, remember your preferences, and
15+
analyze our website traffic. You consent to our cookies if you click
16+
“OK”.
17+
</p>
18+
</div>
19+
<div className={styles.ctaContainer}>
20+
<button className={`button ${styles.approvalButton}`} type="button">
21+
OK
22+
</button>
23+
<button
24+
className={`button button-tertiary ${styles.ignoreButton}`}
25+
type="button"
26+
>
27+
Reject
28+
</button>
29+
</div>
30+
</div>
31+
</div>
32+
);
33+
};
34+
35+
CookieApprovalDialog.propTypes = {
36+
className: PropTypes.string,
37+
darkMode: PropTypes.object
38+
};
39+
40+
export default withDarkMode(CookieApprovalDialog);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
.container {
2+
width: 100%;
3+
position: fixed;
4+
bottom: 0;
5+
z-index: 10000;
6+
background-color: rgba(28,42,47, .92);
7+
box-shadow: 0px -0.249053px 4.26158px rgba(12, 48, 57, 0.0421718), 0px -0.598509px 10.2412px rgba(12, 48, 57, 0.0605839), 0px -1.12694px 19.2832px rgba(12, 48, 57, 0.075), 0px -2.01027px 34.3979px rgba(12, 48, 57, 0.0894161), 0px -3.75998px 64.3375px rgba(12, 48, 57, 0.107828), 0px -9px 154px rgba(12, 48, 57, 0.15);
8+
backdrop-filter: blur(5px);
9+
}
10+
11+
.content {
12+
display: flex;
13+
justify-content: space-between;
14+
align-items: center;
15+
width: 1180px;
16+
margin: 0 auto;
17+
box-sizing: border-box;
18+
padding: 18px 0;
19+
}
20+
21+
.heading {
22+
color: #fff;
23+
margin-top: 0;
24+
margin-bottom: 2px;
25+
line-height: 21px;
26+
}
27+
28+
.description {
29+
margin: 0 0 0px;
30+
font-size: 13px;
31+
line-height: 21px;
32+
color: var(--color-neutrals-500);
33+
}
34+
35+
.cta-container {
36+
margin-left: 16px;
37+
flex-shrink: 0;
38+
}
39+
40+
.approval-button {
41+
margin-right: 10px;
42+
padding: 10px 30px;
43+
}
44+
45+
.button-close {
46+
position: absolute;
47+
top: 4px;
48+
right: 4px;
49+
opacity: .75;
50+
}
51+
52+
// ==============================================================
53+
// Responsive styles
54+
// ==============================================================
55+
@media screen and (max-width: 1200px) {
56+
.content {
57+
width: 100%;
58+
padding: 18px 28px;
59+
}
60+
61+
.heading {
62+
margin-bottom: 6px;
63+
}
64+
65+
.description {
66+
line-height: 19px;
67+
}
68+
}
69+
70+
@media screen and (max-width: 480px) {
71+
.content {
72+
flex-direction: column;
73+
align-items: flex-start;
74+
}
75+
76+
.description {
77+
margin-bottom: 16px;
78+
}
79+
80+
.cta-container {
81+
margin: 0;
82+
}
83+
84+
.approval-button {
85+
padding-top: 8px;
86+
padding-bottom: 8px;
87+
}
88+
89+
.ignore-button {
90+
padding-top: 8px;
91+
padding-bottom: 8px;
92+
color: var(--color-neutrals-700);
93+
}
94+
}
95+
96+
// ==============================================================
97+
// Dark mode
98+
// ==============================================================
99+
:global(.dark-mode) {
100+
.container {
101+
background-color: rgba(15,25,28, .92);
102+
box-shadow: 0 -1px 0 rgba(55,72,78, .4);
103+
}
104+
105+
.description {
106+
color: var(--color-neutrals-600);
107+
}
108+
}

src/components/layout.js

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Header from './Header';
1313
import Footer from './Footer';
1414
import './styles.scss';
1515
import favicon from '../images/favicon.svg';
16+
import CookieApprovalDialog from './CookieApprovalDialog';
1617

1718
const Layout = ({
1819
children,
@@ -36,6 +37,7 @@ const Layout = ({
3637
{children}
3738
</main>
3839
<Footer editLink={editLink} />
40+
<CookieApprovalDialog />
3941
</div>
4042
);
4143
};

src/components/styles.scss

+9-2
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,21 @@ select {
436436
}
437437

438438
.button {
439-
color: var(--color-background);
439+
background-color: var(--color-neutrals-800);
440440
}
441441

442442
.button-secondary {
443-
color: var(--color-brand-400);
443+
color: var(--color-neutrals-800);
444+
box-shadow: inset 0 0 0 2px var(--color-neutrals-800);
445+
background-color: transparent;
444446
}
445447

446448
.button-tertiary {
449+
background-color: inherit;
447450
color: inherit;
451+
452+
&:hover {
453+
background-color: var(--color-neutrals-100);
454+
}
448455
}
449456
}

src/templates/project-page.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ const ProjectPage = props => {
237237
rel="noopener noreferrer"
238238
>
239239
<span className={styles.buttonIcon}>
240-
<Edit color={darkMode.value ? '#70ccd3' : '#007e8a'} size={16} />
240+
<Edit color={darkMode.value ? '#cedede' : '#007e8a'} size={16} />
241241
</span>
242242
Edit page
243243
</a>

0 commit comments

Comments
 (0)