universe:cookie-info
ReactJS component for showing information about using cookies by your app/site.
Adding default cookie info nag
1import CookieInfo from 'meteor/universe:cookie-info'; 2 3<CookieInfo />
Adding custom component as info content
If you add your own component, you have to call props.onConsent()
when user agrees.
1import CookieInfo from 'meteor/universe:cookie-info'; 2 3const YourComponentWithInfo = (props) => ( 4 <div className="cookie-policy"> 5 <p> 6 This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. <a href="/cookies">Find out more here</a>. 7 </p> 8 <p> 9 <a href="#" onClick={e => {e.preventDefault(); props.onConsent();}}> 10 <span className="sr-only">OK</span> 11 </a> 12 </p> 13 </div> 14); 15 16<CookieInfo> 17 <YourComponentWithInfo /> 18</CookieInfo>
Removing default styling
Just set "clearStyle" prop to CookieInfo
.
1<CookieInfo clearStyle> 2 <YourComponentWithInfo /> 3</CookieInfo>