@cuban-engineer/react-cookies-consent
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: (TypeString
, 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:
But the styles can be modified by overriding this css
classes:
-
.cookies-consent
: Entire Component container. -
.cookies-consent-text
: Container of the message showed to the user. -
.cookies-consent-button
Container of the Button for accepting the use of cookies. -
.cookies-consent-link
Container of thea
tag for the link.
License
@cuban-engineer/react-cookies-consent is MIT-licensed.