File size: 2,013 Bytes
ae238b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import CookieConsent from "react-cookie-consent";
import { CONSENT_COOKIE_NAME } from "./Analytics";

interface CookieBannerProps {
  onAccept?: (acceptedByScrolling: boolean) => void;
  onDecline?: () => void;
}

const CookieBanner = ({ onAccept, onDecline }: CookieBannerProps) => {
  return (
    <CookieConsent
      style={{
        backgroundColor: "white",
        color: "black",
        alignItems: "center",
        flexDirection: "column",
      }}
      contentStyle={{ flex: 1, margin: 0 }}
      overlayStyle={{ backgroundColor: "rgba(0, 0, 0, .65)" }}
      overlay
      cookieName={CONSENT_COOKIE_NAME}
      disableButtonStyles
      declineButtonClasses="bg-gray-800 hover:bg-gray-900 text-white border border-gray-600 w-[136px] md:w-[208px] h-[36px] capitalize text-base font-medium rounded px-4 py-2 transition-colors"
      buttonClasses="bg-blue-600 hover:bg-blue-700 text-white border-blue-600 w-[136px] md:w-[208px] h-[36px] capitalize text-base font-medium rounded px-4 py-2 transition-colors"
      buttonText="Accept"
      declineButtonText="Decline"
      enableDeclineButton={true}
      onAccept={onAccept}
      onDecline={onDecline}
      containerClasses="text-base font-medium p-10 md:p-14 pb-14 text-center" // overriding the default so that the popup isn't hidden by adblockers: https://github.com/Mastermindzh/react-cookie-consent/issues/64
      contentClasses="max-w-[565px]"
      buttonWrapperClasses="mt-7 mb-2 flex gap-5"
    >
      {" "}
      Allow the use of cookies from Meta on this browser? To find out more about
      the use of cookies, see our{" "}
      <a href="https://www.facebook.com/privacy/policy" target="_blank" rel="noopener noreferrer">
        <b>Privacy Policy</b>
      </a>{" "}
      and{" "}
      <a
        href="https://www.facebook.com/privacy/policies/cookies"
        target="_blank"
        rel="noopener noreferrer"
      >
        <b>Cookies Policy</b>
      </a>
      .
    </CookieConsent>
  );
};

export default CookieBanner;