buildo / react-cookie-banner

React Cookie banner which can be automatically dismissed with a scroll. Because fuck The Cookie Law, that's why.
http://react-components.buildo.io/#cookiebanner
MIT License
182 stars 19 forks source link

Template and cookie logic should live in different components #29

Closed FrancescoCioria closed 7 years ago

FrancescoCioria commented 7 years ago

requirements

Currently the banner template and the cookie management logic are not completely independent. This may cause conflicts in case a user needs to add a layer between the two (ex: #28 ).

specs

We should separate the cookie management logic and the banner template in two different components: CookieBanner (default) and Content.

The Content component would be exported as well and used as default by CookieBanner and it would accept any template related prop.

misc

After this separation the issue described in #28 could be solved by doing:

<CookieBanner {...cookieProps}>
  {(onAccept) => <div onClick={onAccept}><Content {...templateProps} /></div>}
</CookieBanner>