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

Custom component can receive onAccept prop using a children function #25

Closed lvauvillier closed 7 years ago

lvauvillier commented 7 years ago

There was no possibility to bind the onAccept callback to a custom element to dismiss the banner.

This PR solves this allowing to set a function as children with a onAccept argument. This function must return a valid react element.

lvauvillier commented 7 years ago

Thanks for your review. I just push a new version. Eslint now raise an error due to the definition of MyOtherComponent. Tell me if you prefer adding a new rule, or a eslint-disable-line comment to catch this error.

gabro commented 7 years ago

@lvauvillier I pushed a commit to your branch that should fix the ESLint issue ;)

nemobot commented 7 years ago

gabro commented 7 years ago

Thanks @lvauvillier 🎉