mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-08-01 07:04:34 +02:00
Auto hide (#19)
This commit is contained in:
@@ -770,11 +770,14 @@ var CookieConsent = function (_Component) {
|
||||
value: function accept() {
|
||||
var _props2 = this.props,
|
||||
cookieName = _props2.cookieName,
|
||||
expires = _props2.expires;
|
||||
expires = _props2.expires,
|
||||
hideOnAccept = _props2.hideOnAccept;
|
||||
|
||||
|
||||
_jsCookie2.default.set(cookieName, true, { expires: expires });
|
||||
this.setState({ visible: false });
|
||||
if (hideOnAccept) {
|
||||
this.setState({ visible: false });
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
@@ -862,6 +865,7 @@ CookieConsent.propTypes = {
|
||||
contentStyle: _propTypes2.default.object,
|
||||
children: _propTypes2.default.any, // eslint-disable-line react/forbid-prop-types
|
||||
disableStyles: _propTypes2.default.bool,
|
||||
hideOnAccept: _propTypes2.default.bool,
|
||||
onAccept: _propTypes2.default.func,
|
||||
buttonText: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func, _propTypes2.default.element]),
|
||||
cookieName: _propTypes2.default.string,
|
||||
@@ -874,6 +878,7 @@ CookieConsent.propTypes = {
|
||||
|
||||
CookieConsent.defaultProps = {
|
||||
disableStyles: false,
|
||||
hideOnAccept: true,
|
||||
location: OPTIONS.BOTTOM,
|
||||
onAccept: function onAccept() {},
|
||||
cookieName: "CookieConsent",
|
||||
|
Reference in New Issue
Block a user