From 8cba0b05d2318900b4de5b9656f20ed67b187bc4 Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Tue, 3 Dec 2024 14:33:39 +0000 Subject: [PATCH 1/2] chore: redesign cookie consent modal --- .../CookieConsentModal/CookieConsentModal.tsx | 147 +++++++----------- .../CookieConsentModal/styles.module.css | 34 +--- 2 files changed, 59 insertions(+), 122 deletions(-) diff --git a/src/components/shared/CookieConsentModal/CookieConsentModal.tsx b/src/components/shared/CookieConsentModal/CookieConsentModal.tsx index bb1f9f9f2f..0c2dc886dd 100644 --- a/src/components/shared/CookieConsentModal/CookieConsentModal.tsx +++ b/src/components/shared/CookieConsentModal/CookieConsentModal.tsx @@ -41,12 +41,12 @@ const CookieConsentModal: React.FC = ({open, onAccept, }, } : { - text: "Manage Preferences", + text: "Manage Settings", onClick: () => setShowPreferences(true), }, ], { - text: "Accept Only Essential", + text: "Deny", onClick: onDeny, }, ] @@ -67,18 +67,6 @@ const CookieConsentModal: React.FC = ({open, onAccept, }, []) }, [preferences]) - useEffect(() => { - if (typeof window === "undefined") return - - if (open) { - requestAnimationFrame(() => { - document.body.style.overflow = "hidden" - }) - } else { - document.body.style.overflow = "visible" - } - }, [open]) - const handlePreferenceToggle = (index: number) => { if (preferences[index].readonly) return @@ -98,97 +86,72 @@ const CookieConsentModal: React.FC = ({open, onAccept, <> {open ? ( <> - {/* Overlay */} -
- {/* Modal Container */} -
-
-
-
- - We Value Your Privacy - - Our website uses cookies to enhance your browsing experience, improve website functionality, and - analyze website traffic. We also collect and process your IP address for purposes such as ensuring - security and maintaining network performance. - - - You can choose which cookies to accept by selecting your preferences below. Essential cookies are - necessary for the website to function and cannot be disabled. By clicking “Accept All” you consent - to the use of all cookies. - - - For more information, please review our{" "} - - Privacy Policy - - . - - {showPreferences && ( -
- {preferences.map((preference: PreferenceOption, index: number) => { - return ( - handlePreferenceToggle(index)} - > - {`${preference.selected ? `[ X ]` : `[ ]`}`} - {preference.name} - - ) - })} -
- )} -
-
- {consentOptions.map((btn: ConsentOption, index: number) => { +
+
+
+ We Value Your Privacy + + This website uses cookies to ensure you receive the best possible experience.{" "} + + Learn More + + . + +
+ {showPreferences && ( +
+ {preferences.map((preference: PreferenceOption, index: number) => { return ( handlePreferenceToggle(index)} > - {btn.text} + {`${preference.selected ? `[ X ]` : `[ ]`}`} + {preference.name} ) })}
+ )} +
+
+
+ {consentOptions.map((btn: ConsentOption, index: number) => { + return ( + + {btn.text} + + ) + })}
- - Cookie Settings - -
+
) : null} diff --git a/src/components/shared/CookieConsentModal/styles.module.css b/src/components/shared/CookieConsentModal/styles.module.css index 4d0e98ee0b..18999b71f1 100644 --- a/src/components/shared/CookieConsentModal/styles.module.css +++ b/src/components/shared/CookieConsentModal/styles.module.css @@ -1,18 +1,9 @@ .cookieConsentModal { position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - max-height: 80%; - max-width: 90%; - overflow-y: scroll; + bottom: 24px; + left: 24px; + right: 24px; z-index: calc(var(--ifm-z-index-fixed) + 2); - box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1); -} - -.modalOverlay { - z-index: calc(var(--ifm-z-index-fixed) + 1); - backdrop-filter: blur(12px); } .consentOption { @@ -30,22 +21,9 @@ color: #e7e7e7; } -.modalHeading { - top: 0; - left: 50%; - transform: translate(-50%, calc(-50% + 4px)); -} - .closeBtn { - top: 0; + top: 8px; right: 30px; - transform: translate(-50%, calc(-50% + 4px)); -} - -.bodyContainer { - background-image: radial-gradient(circle, #121214 10%, transparent 10%); - background-size: 8px 8px; - background-repeat: repeat; } @media (max-width: 1000px) { @@ -55,10 +33,6 @@ width: 100%; } - .modalHeading { - width: max-content; - } - .closeBtn { right: 15px; } From d3acd0264582984f8bae62d60edf9716ae6b2513 Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Wed, 4 Dec 2024 19:04:05 +0000 Subject: [PATCH 2/2] chore: responsive UI --- .../CookieConsentModal/CookieConsentModal.tsx | 20 +++++++++++-------- .../CookieConsentModal/styles.module.css | 10 +++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/shared/CookieConsentModal/CookieConsentModal.tsx b/src/components/shared/CookieConsentModal/CookieConsentModal.tsx index 0c2dc886dd..5a257225b4 100644 --- a/src/components/shared/CookieConsentModal/CookieConsentModal.tsx +++ b/src/components/shared/CookieConsentModal/CookieConsentModal.tsx @@ -89,14 +89,14 @@ const CookieConsentModal: React.FC = ({open, onAccept, {/* Modal Container */}
- We Value Your Privacy - + We Value Your Privacy + This website uses cookies to ensure you receive the best possible experience.{" "} = ({open, onAccept, > Learn More - .
{showPreferences && ( -
+
{preferences.map((preference: PreferenceOption, index: number) => { return ( handlePreferenceToggle(index)} @@ -128,13 +127,18 @@ const CookieConsentModal: React.FC = ({open, onAccept, )}
-
+
{consentOptions.map((btn: ConsentOption, index: number) => { return (