From 9726e0810605ec32fb9e626939a02b736d48f879 Mon Sep 17 00:00:00 2001 From: VieraBoschkova Date: Wed, 14 Apr 2021 09:19:17 +0200 Subject: [PATCH 1/3] feat: add cookies disclaimer --- .../src/components/CookiesDesclaimer/index.js | 27 +++++++++++++++++++ client/src/components/Navbar/index.js | 2 ++ client/src/components/Navbar/style.scss | 19 +++++++++++++ client/src/utils/localStorage/index.js | 14 ++++++++++ 4 files changed, 62 insertions(+) create mode 100644 client/src/components/CookiesDesclaimer/index.js create mode 100644 client/src/utils/localStorage/index.js diff --git a/client/src/components/CookiesDesclaimer/index.js b/client/src/components/CookiesDesclaimer/index.js new file mode 100644 index 0000000..0f453b5 --- /dev/null +++ b/client/src/components/CookiesDesclaimer/index.js @@ -0,0 +1,27 @@ +import { useState } from 'react'; +import { getLocalStorage, setLocalStorage } from '../../utils/localStorage'; + +function CookiesDesclaimer() { + const hasCookie = getLocalStorage('cookies-consent'); + const [cookiesConsent, setCookiesConsent] = useState(hasCookie); + const handleCookies = () => { + setLocalStorage('cookies-consent', true); + setCookiesConsent(true); + }; + return !cookiesConsent ? ( +
+

This website uses cookies

+

+ We use cookies to give you the best online experience. Please let us + know if you agree. +

+
+ +
+
+ ) : null; +} + +export default CookiesDesclaimer; diff --git a/client/src/components/Navbar/index.js b/client/src/components/Navbar/index.js index 84b33b6..ef53ad0 100644 --- a/client/src/components/Navbar/index.js +++ b/client/src/components/Navbar/index.js @@ -9,6 +9,7 @@ import AuthenticatedNavBar from './AuthenticatedNavbar'; import { CinemaContext } from '../../context/Cinema'; import { ReservationContext } from '../../context/Reservation'; import { RESET_RESERVATION } from '../../actions/types'; +import CookiesDesclaimer from '../CookiesDesclaimer'; function Navbar() { const history = useHistory(); @@ -49,6 +50,7 @@ function Navbar() { )} + ); } diff --git a/client/src/components/Navbar/style.scss b/client/src/components/Navbar/style.scss index a8767cb..6aaa11a 100644 --- a/client/src/components/Navbar/style.scss +++ b/client/src/components/Navbar/style.scss @@ -1,5 +1,6 @@ @import '../../styles/variables'; .navbar { + position: relative; padding: 16px 32px; background-color: #000; color: #f1f1f1; @@ -34,3 +35,21 @@ display: flex; align-items: flex-start; } + +.cookies { + position: absolute; + top: 0; + width: 100vw; + padding-top: 88px; + height: 100vh; + left: 0; + text-align: center; + display: flex; + flex-direction: column; + justify-content: center; + background-image: radial-gradient(rgba(255, 255, 255, 0.5) 5%, rgba(204, 204, 204, 0.5) 15%, rgba(0, 0, 0, 0.5) 60%, rgba(0, 0, 0, 0.8) 90%); + z-index: 1; + & p { + line-height: 2; + } +} diff --git a/client/src/utils/localStorage/index.js b/client/src/utils/localStorage/index.js new file mode 100644 index 0000000..10b6d32 --- /dev/null +++ b/client/src/utils/localStorage/index.js @@ -0,0 +1,14 @@ +export const setLocalStorage = (key, value) => { + localStorage.setItem(key, value); +}; + +// Retrieve information from local storage +export const getLocalStorage = (key) => { + const reservationValue = JSON.parse(localStorage.getItem(key)); + return reservationValue; +}; + +// Remove information from local storage +export const removeLocalStorage = (key) => { + localStorage.removeItem(key); +}; From 48156a7cb3c72cebd3139838117e3d99167ff5ab Mon Sep 17 00:00:00 2001 From: VieraBoschkova Date: Wed, 14 Apr 2021 09:20:54 +0200 Subject: [PATCH 2/3] format --- client/src/components/Navbar/style.scss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/components/Navbar/style.scss b/client/src/components/Navbar/style.scss index 6aaa11a..ee120ac 100644 --- a/client/src/components/Navbar/style.scss +++ b/client/src/components/Navbar/style.scss @@ -47,7 +47,12 @@ display: flex; flex-direction: column; justify-content: center; - background-image: radial-gradient(rgba(255, 255, 255, 0.5) 5%, rgba(204, 204, 204, 0.5) 15%, rgba(0, 0, 0, 0.5) 60%, rgba(0, 0, 0, 0.8) 90%); + background-image: radial-gradient( + rgba(255, 255, 255, 0.5) 5%, + rgba(204, 204, 204, 0.5) 15%, + rgba(0, 0, 0, 0.5) 60%, + rgba(0, 0, 0, 0.8) 90% + ); z-index: 1; & p { line-height: 2; From dcb76617ba2926494cba3f88881d37c301027dfe Mon Sep 17 00:00:00 2001 From: VieraBoschkova Date: Wed, 14 Apr 2021 17:30:18 +0200 Subject: [PATCH 3/3] feat: modify cookie desclaimer --- .../src/components/CookiesDesclaimer/index.js | 20 ++++++------ client/src/components/Navbar/style.scss | 31 ++++++++++++------- client/src/styles/_global.scss | 1 + 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/client/src/components/CookiesDesclaimer/index.js b/client/src/components/CookiesDesclaimer/index.js index 0f453b5..c6d5f43 100644 --- a/client/src/components/CookiesDesclaimer/index.js +++ b/client/src/components/CookiesDesclaimer/index.js @@ -10,15 +10,17 @@ function CookiesDesclaimer() { }; return !cookiesConsent ? (
-

This website uses cookies

-

- We use cookies to give you the best online experience. Please let us - know if you agree. -

-
- +
+

This website uses cookies

+

+ We use cookies to give you the best online experience. Please let us + know if you agree. +

+
+ +
) : null; diff --git a/client/src/components/Navbar/style.scss b/client/src/components/Navbar/style.scss index ee120ac..316c6d5 100644 --- a/client/src/components/Navbar/style.scss +++ b/client/src/components/Navbar/style.scss @@ -1,6 +1,5 @@ @import '../../styles/variables'; .navbar { - position: relative; padding: 16px 32px; background-color: #000; color: #f1f1f1; @@ -40,21 +39,29 @@ position: absolute; top: 0; width: 100vw; - padding-top: 88px; - height: 100vh; + padding-top: 25vh; + height: 100%; left: 0; text-align: center; - display: flex; - flex-direction: column; - justify-content: center; - background-image: radial-gradient( - rgba(255, 255, 255, 0.5) 5%, - rgba(204, 204, 204, 0.5) 15%, - rgba(0, 0, 0, 0.5) 60%, - rgba(0, 0, 0, 0.8) 90% - ); + background-color: #0000007b; + z-index: 1; & p { + line-height: 1.5; + } + & h3 { line-height: 2; } + &-text { + width: 50vw; + height: 50vh; + background-color: #000; + border-radius: 4px; + margin: 0 auto; + padding: 32px; + display: flex; + flex-direction: column; + justify-content: center; + font-weight: 400; + } } diff --git a/client/src/styles/_global.scss b/client/src/styles/_global.scss index 5bbca18..b8b3c7d 100644 --- a/client/src/styles/_global.scss +++ b/client/src/styles/_global.scss @@ -15,6 +15,7 @@ body { display: flex; flex-direction: column; justify-content: space-between; + position: relative; } .dark-mode {