Skip to content

React component for the managing the user awareness regarding cookies usage

License

Notifications You must be signed in to change notification settings

aleph-engineering/react-cookies-consent

Repository files navigation

@cuban-engineer/react-cookies-consent

code style: prettier code linting: eslint code quality: jest MIT license

React component for the managing the user awareness regarding cookies usage

Install

npm install --save @cuban-engineer/react-cookies-consent

or

yarn add @cuban-engineer/react-cookies-consent

Usage

import React, { Component } from 'react'

import CookiesConsent from '@cuban-engineer/react-cookies-consent'

class Example extends Component {
  render () {
    return (
      <CookiesConsent />
    )
  }
}

Available props

  • cookiesId Value with which the cookie will be save in the browser: (Type: String, Default value: 'cookies-consent')
  • message Message that will be show to the user: (Type String, Default value: 'Cookies help us deliver our services. By using our services, you agree to our use of cookies.')
  • buttonMessage Text of the submit action button: (Type: String, Default value: 'OK')
  • expiresIn Time needed for the cookie to expire: (Type: Number, Default value: 365)
  • link Link for more information pages: (Type: Object, Default values: { url: undefined, text: undefined, target: '_blank'})

Styling

By default the rendered component will be fixed at the bottom and will look like this:

React Cookies Consent Component

But the styles can be modified by overriding this css classes:

  1. .cookies-consent: Entire Component container.
  2. .cookies-consent-text: Container of the message showed to the user.
  3. .cookies-consent-button Container of the Button for accepting the use of cookies.
  4. .cookies-consent-link Container of the a tag for the link.

License

@cuban-engineer/react-cookies-consent is MIT-licensed.

About

React component for the managing the user awareness regarding cookies usage

Resources

License

Stars

Watchers

Forks

Packages

No packages published