Skip to content
Snippets Groups Projects
Cookies.tsx 1.11 KiB
Newer Older
Tojo's avatar
Tojo committed
import React from "react";
import CookieConsent, { Cookies as cookie } from "react-cookie-consent";
Tojo's avatar
Tojo committed

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 Cookies = (props: Icookies) => {
Tojo's avatar
Tojo committed
  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()
        // cookie.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 Cookies;