Skip to content

Commit

Permalink
DEV Save
Browse files Browse the repository at this point in the history
  • Loading branch information
madebyrogal authored and pkosiec committed Aug 8, 2023
1 parent 1863918 commit 7d98706
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const config = {
},
],

clientModules: [require.resolve("./src/clientModules/cloud-communication.ts")],

plugins: [
"docusaurus-plugin-sass",
[
Expand Down
25 changes: 25 additions & 0 deletions src/clientModules/cloud-communication.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";

const globalParams = {
cookie: {
hide: true,
},
};

if (ExecutionEnvironment.canUseDOM) {
document.addEventListener("DOMContentLoaded", function () {
console.log("Test DOM loaded");
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.globalParams = globalParams;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
console.log("window.globalParams", window.globalParams);
const cookieBannerElem = document.querySelector<HTMLDivElement>(".react-cookie-banner");
console.log("cookieBannerElem", cookieBannerElem);
if (cookieBannerElem) {
console.log("Cookie banner exist");
cookieBannerElem.style.display = "none";
}
});
}
4 changes: 4 additions & 0 deletions src/components/CookieBanner/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
}
}

.bannerHide {
display: none;
}

@media (max-width: $infimaBP) {
.banner {
flex-flow: column wrap;
Expand Down
4 changes: 3 additions & 1 deletion src/components/CookieBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import styles from "./index.module.scss";
export const CookiesMessageBanner: FC = () => {
const cookies = new Cookies();

if (!cookies || cookies.get("accepts-cookies")) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (!cookies || cookies.get("accepts-cookies") || window.globalParams?.cookie?.hide) {
return null;
}

Expand Down

0 comments on commit 7d98706

Please sign in to comment.