mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-01-20 18:41:44 +01:00
Merge pull request #26 from delaneymethod/feature/button-id
Added new buttonId prop
This commit is contained in:
commit
55267ebfce
@ -92,6 +92,7 @@ One of the props (onAccept) is a function, this function will be called after th
|
|||||||
| extraCookieOptions | object | `{}` | Extra info (apart from expiry date) to add to the cookie|
|
| extraCookieOptions | object | `{}` | Extra info (apart from expiry date) to add to the cookie|
|
||||||
| containerClasses| string | "" | CSS classes to apply to the surrounding container |
|
| containerClasses| string | "" | CSS classes to apply to the surrounding container |
|
||||||
| buttonClasses | string | "" | CSS classes to apply to the button |
|
| buttonClasses | string | "" | CSS classes to apply to the button |
|
||||||
|
| buttonId | string | "" | Id to apply to the button |
|
||||||
| contentClasses| string | "" | CSS classes to apply to the content |
|
| contentClasses| string | "" | CSS classes to apply to the content |
|
||||||
| style | object | [look at source][style] | React styling object for the bar. |
|
| style | object | [look at source][style] | React styling object for the bar. |
|
||||||
| buttonStyle | object | [look at source][buttonStyle] | React styling object for the button. |
|
| buttonStyle | object | [look at source][buttonStyle] | React styling object for the button. |
|
||||||
|
@ -669,7 +669,8 @@ var CookieConsent = function (_Component) {
|
|||||||
buttonText = _props3.buttonText,
|
buttonText = _props3.buttonText,
|
||||||
containerClasses = _props3.containerClasses,
|
containerClasses = _props3.containerClasses,
|
||||||
contentClasses = _props3.contentClasses,
|
contentClasses = _props3.contentClasses,
|
||||||
buttonClasses = _props3.buttonClasses;
|
buttonClasses = _props3.buttonClasses,
|
||||||
|
buttonId = _props3.buttonId;
|
||||||
|
|
||||||
|
|
||||||
var myStyle = {};
|
var myStyle = {};
|
||||||
@ -714,6 +715,7 @@ var CookieConsent = function (_Component) {
|
|||||||
{
|
{
|
||||||
style: myButtonStyle,
|
style: myButtonStyle,
|
||||||
className: buttonClasses,
|
className: buttonClasses,
|
||||||
|
id: buttonId,
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
_this2.accept();
|
_this2.accept();
|
||||||
}
|
}
|
||||||
@ -746,6 +748,7 @@ CookieConsent.propTypes = {
|
|||||||
containerClasses: _propTypes2.default.string,
|
containerClasses: _propTypes2.default.string,
|
||||||
contentClasses: _propTypes2.default.string,
|
contentClasses: _propTypes2.default.string,
|
||||||
buttonClasses: _propTypes2.default.string,
|
buttonClasses: _propTypes2.default.string,
|
||||||
|
buttonId: _propTypes2.default.string,
|
||||||
acceptOnScroll: _propTypes2.default.bool,
|
acceptOnScroll: _propTypes2.default.bool,
|
||||||
acceptOnScrollPercentage: _propTypes2.default.number,
|
acceptOnScrollPercentage: _propTypes2.default.number,
|
||||||
extraCookieOptions: _propTypes2.default.object
|
extraCookieOptions: _propTypes2.default.object
|
||||||
@ -766,6 +769,7 @@ CookieConsent.defaultProps = {
|
|||||||
containerClasses: "",
|
containerClasses: "",
|
||||||
contentClasses: "",
|
contentClasses: "",
|
||||||
buttonClasses: "",
|
buttonClasses: "",
|
||||||
|
buttonId: "",
|
||||||
extraCookieOptions: {}
|
extraCookieOptions: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"name": "Rick van Lieshout",
|
"name": "Rick van Lieshout",
|
||||||
"email": "info@rickvanlieshout.com"
|
"email": "info@rickvanlieshout.com"
|
||||||
},
|
},
|
||||||
"version": "1.8.0",
|
"version": "1.8.1",
|
||||||
"description": "A small, simple and customizable cookie consent bar for use in React applications.",
|
"description": "A small, simple and customizable cookie consent bar for use in React applications.",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -118,7 +118,8 @@ class CookieConsent extends Component {
|
|||||||
buttonText,
|
buttonText,
|
||||||
containerClasses,
|
containerClasses,
|
||||||
contentClasses,
|
contentClasses,
|
||||||
buttonClasses
|
buttonClasses,
|
||||||
|
buttonId,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
let myStyle = {};
|
let myStyle = {};
|
||||||
@ -158,6 +159,7 @@ class CookieConsent extends Component {
|
|||||||
<button
|
<button
|
||||||
style={myButtonStyle}
|
style={myButtonStyle}
|
||||||
className={buttonClasses}
|
className={buttonClasses}
|
||||||
|
id={buttonId}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.accept();
|
this.accept();
|
||||||
}}
|
}}
|
||||||
@ -194,6 +196,7 @@ CookieConsent.propTypes = {
|
|||||||
containerClasses: PropTypes.string,
|
containerClasses: PropTypes.string,
|
||||||
contentClasses: PropTypes.string,
|
contentClasses: PropTypes.string,
|
||||||
buttonClasses: PropTypes.string,
|
buttonClasses: PropTypes.string,
|
||||||
|
buttonId: PropTypes.string,
|
||||||
acceptOnScroll: PropTypes.bool,
|
acceptOnScroll: PropTypes.bool,
|
||||||
acceptOnScrollPercentage: PropTypes.number,
|
acceptOnScrollPercentage: PropTypes.number,
|
||||||
extraCookieOptions: PropTypes.object
|
extraCookieOptions: PropTypes.object
|
||||||
@ -214,6 +217,7 @@ CookieConsent.defaultProps = {
|
|||||||
containerClasses: "",
|
containerClasses: "",
|
||||||
contentClasses: "",
|
contentClasses: "",
|
||||||
buttonClasses: "",
|
buttonClasses: "",
|
||||||
|
buttonId: "",
|
||||||
extraCookieOptions: {}
|
extraCookieOptions: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user