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

Add a 'cookiePath' property #34

Merged
merged 1 commit into from
May 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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