Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #34 from ghostd/add-cookie-path-prop
Browse files Browse the repository at this point in the history
Add a 'cookiePath' property
  • Loading branch information
FrancescoCioria authored May 3, 2017
2 parents 3ba36a3 + 913fb20 commit 3957dfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/CookieBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Props = {
hours: t.maybe(t.Number)
})
])),
cookiePath: t.maybe(t.String),
dismissOnScroll: t.maybe(t.Boolean),
dismissOnScrollThreshold: t.maybe(t.Number)
};
Expand All @@ -34,6 +35,7 @@ const Props = {
* @param buttonMessage - message written inside the button of the default cookie banner
* @param cookie - cookie-key used to save user's decision about you cookie-policy
* @param cookieExpiration - used to set the cookie expiration
* @param cookiePath - used to set the cookie path
* @param dismissOnScroll - whether the cookie banner should be dismissed on scroll or not
* @param dismissOnScrollThreshold -
* amount of pixel the user need to scroll to dismiss the cookie banner
Expand Down Expand Up @@ -112,9 +114,9 @@ export default class CookieBanner extends React.Component {
}

onAccept = () => {
const { cookie, cookieExpiration, onAccept } = this.props;
const { cookie, cookieExpiration, cookiePath, onAccept } = this.props;

cookieLite(cookie, true, this.getSecondsSinceExpiration(cookieExpiration));
cookieLite(cookie, true, this.getSecondsSinceExpiration(cookieExpiration), cookiePath);
onAccept({ cookie });

if (this.state.listeningScroll) {
Expand Down
1 change: 1 addition & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ React Cookie banner dismissable with just a scroll!
| **buttonMessage** | <code>String</code> | <code>"Got it"</code> | *optional*. Message written inside the button of the default cookie banner |
| **cookie** | <code>String</code> | <code>"accepts-cookies"</code> | *optional*. Cookie-key used to save user's decision about you cookie-policy |
| **cookieExpiration** | <code>union(Integer &#124; {years: ?Number, days: ?Number, hours: ?Number})</code> | <code>{ "years": 1 }</code> | *optional*. Used to set the cookie expiration |
| **cookiePath** | <code>String</code> | | *optional*. Used to set the cookie path |
| **dismissOnScroll** | <code>Boolean</code> | <code>true</code> | *optional*. Whether the cookie banner should be dismissed on scroll or not |
| **dismissOnScrollThreshold** | <code>Number</code> | <code>0</code> | *optional*. amount of pixel the user need to scroll to dismiss the cookie banner |
| **closeIcon** | <code>String</code> | | *optional*. ClassName passed to close-icon |
Expand Down

0 comments on commit 3957dfa

Please sign in to comment.