Skip to content

Commit

Permalink
add cookie consent modal
Browse files Browse the repository at this point in the history
  • Loading branch information
webloopbox committed Oct 15, 2024
1 parent fb82a9d commit ea269b5
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 42 deletions.
53 changes: 13 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions website/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ body {
filter: invert(1);
}

#cc-main {
/** Change font **/
--cc-font-family: Roboto;

/** Change button primary color to black **/
--cc-btn-primary-bg: var(--green-primary);
--cc-btn-primary-border-color: transparent;
--cc-btn-primary-hover-bg: #444444;
--cc-btn-primary-hover-border-color: #444444;

/** Also make toggles the same color as the button **/
--cc-toggle-on-bg: var(--cc-btn-primary-bg);

/** Make the buttons a bit rounder **/
--cc-btn-border-radius: 10px;
}

@media (min-width: 780px) {
.flex-none {
display: none;
Expand Down
3 changes: 3 additions & 0 deletions website/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { DM_Mono, DM_Sans } from "next/font/google";
import "./globals.css";
import Header from "../components/header";
import { Footer } from "@/components/footer";
import "vanilla-cookieconsent/dist/cookieconsent.css";
import CookieConsentComponent from "../components/cookie-consent";

const dm_sans = DM_Sans({
subsets: ["latin"],
Expand Down Expand Up @@ -34,6 +36,7 @@ export default function RootLayout({
{children}
<Footer />
</Header>
<CookieConsentComponent />
</body>
</html>
);
Expand Down
15 changes: 15 additions & 0 deletions website/components/cookie-consent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use client";

import { useEffect } from "react";
import * as CookieConsent from "vanilla-cookieconsent";
import pluginConfig from "../lib/cookie-consent-config";

const CookieConsentComponent = () => {
useEffect(() => {
CookieConsent.run(pluginConfig);
}, []);

return null;
};

export default CookieConsentComponent;
Loading

0 comments on commit ea269b5

Please sign in to comment.