React Cookie Banner
React Cookie banner which can be dismissed with just a scroll. Because fuck The Cookie Law that's why.
If you really want to annoy your users you can disable this feature (highly discouraged!).
import CookieBanner from 'react-cookie-banner'; React;
Install
npm install --save react-cookie-banner
API
You can see CookieBanner
's props in its own README.md
Style
ReactCookieBanner by default uses its simple inline style. However you can easily disable it by passing
<CookieBanner = />
In this case you can style it using css classes. The banner is structured as follows:
{this.props.message} Learn more Got it
You can also pass your own CustomCookieBanner as child component which will be rendered in replacement:
<CookieBanner> <CustomCookieBanner /> /* rendered directly without any <div> wrapper */</CookieBanner>
Or you override the predefined inline-styles. This examples puts the message font back to normal weight and makes the banner slightly transparent:
<CookieBanner = ='...'/>
See src/styleUtils.js
for which style objects are availble to be overridden.
Cookie manipulation
ReactCookieBanner uses and exports the library browser-cookie-lite
You can import and use it as follows:
; // simple set// complex set - cookie(name, value, ttl, path, domain, secure)// get// destroy
Please refer to browser-cookie-lite repo for more documentation.