Skip to content
Snippets Groups Projects
CookiesComponent.tsx 1.18 KiB
Newer Older
Tojo's avatar
Tojo committed
import React from "react";
// import {CookieNotice} from "gatsby-cookie-notice";
import CookieConsent, { Cookies } from "react-cookie-consent";

interface Icookies {
    location?: string,
    buttonText?: string,
Tojo's avatar
Tojo committed
    declineButtonText?: String,
Tojo's avatar
Tojo committed
    expires?: number,
Tojo's avatar
Tojo committed
    styles?: {},
    buttonStyles?: {},
    declineButtonStyle?: {},
    decline: any
Tojo's avatar
Tojo committed
}

const CookiesComponent = (props: Icookies) => {
  const {
    location="bottom",
Tojo's avatar
Tojo committed
    buttonText="Accepter",
    declineButtonText="Refuser", 
Tojo's avatar
Tojo committed
    buttonStyles, 
    expires=365, 
    styles,
Tojo's avatar
Tojo committed
    declineButtonStyle,
    decline
Tojo's avatar
Tojo committed
  } = props;
  return (
    <CookieConsent
      location={location}
      buttonText={buttonText}
      declineButtonText={declineButtonText}
Tojo's avatar
Tojo committed
      cookieName="onegeo-portal-gdpr"
Tojo's avatar
Tojo committed
      style={styles}
      buttonStyle={buttonStyles}
      declineButtonStyle={declineButtonStyle}
      expires={expires}
      enableDeclineButton
      onDecline={() => {
Tojo's avatar
Tojo committed
        decline()
        // Cookies.remove("tagManagerCookieName")
Tojo's avatar
Tojo committed
      }}
    >
      Nous nous soucions de vos données personnelles et utilisons des cookies afin d’améliorer votre expérience.
    </CookieConsent>
  );
};

export default CookiesComponent;