mirror of
				https://github.com/Mastermindzh/react-cookie-consent.git
				synced 2025-11-04 02:38:50 +01:00 
			
		
		
		
	Added new buttonId prop
Signed-off-by: Sean Delaney <hello@delaneymethod.com>
This commit is contained in:
		@@ -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|
 | 
			
		||||
| containerClasses| string                         | ""        | CSS classes to apply to the surrounding container                                                         |
 | 
			
		||||
| 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                                                                              |
 | 
			
		||||
| style         | object                           | [look at source][style]        | React styling object for the bar.                                                    |
 | 
			
		||||
| buttonStyle   | object                           | [look at source][buttonStyle]  | React styling object for the button.                                                 |
 | 
			
		||||
 
 | 
			
		||||
@@ -669,7 +669,8 @@ var CookieConsent = function (_Component) {
 | 
			
		||||
          buttonText = _props3.buttonText,
 | 
			
		||||
          containerClasses = _props3.containerClasses,
 | 
			
		||||
          contentClasses = _props3.contentClasses,
 | 
			
		||||
          buttonClasses = _props3.buttonClasses;
 | 
			
		||||
          buttonClasses = _props3.buttonClasses,
 | 
			
		||||
          buttonId = _props3.buttonId;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      var myStyle = {};
 | 
			
		||||
@@ -714,6 +715,7 @@ var CookieConsent = function (_Component) {
 | 
			
		||||
          {
 | 
			
		||||
            style: myButtonStyle,
 | 
			
		||||
            className: buttonClasses,
 | 
			
		||||
            id: buttonId,
 | 
			
		||||
            onClick: function onClick() {
 | 
			
		||||
              _this2.accept();
 | 
			
		||||
            }
 | 
			
		||||
@@ -746,6 +748,7 @@ CookieConsent.propTypes = {
 | 
			
		||||
  containerClasses: _propTypes2.default.string,
 | 
			
		||||
  contentClasses: _propTypes2.default.string,
 | 
			
		||||
  buttonClasses: _propTypes2.default.string,
 | 
			
		||||
  buttonId: _propTypes2.default.string,
 | 
			
		||||
  acceptOnScroll: _propTypes2.default.bool,
 | 
			
		||||
  acceptOnScrollPercentage: _propTypes2.default.number,
 | 
			
		||||
  extraCookieOptions: _propTypes2.default.object
 | 
			
		||||
@@ -766,6 +769,7 @@ CookieConsent.defaultProps = {
 | 
			
		||||
  containerClasses: "",
 | 
			
		||||
  contentClasses: "",
 | 
			
		||||
  buttonClasses: "",
 | 
			
		||||
  buttonId: "",
 | 
			
		||||
  extraCookieOptions: {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
    "name": "Rick van Lieshout",
 | 
			
		||||
    "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.",
 | 
			
		||||
  "main": "build/index.js",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,8 @@ class CookieConsent extends Component {
 | 
			
		||||
      buttonText,
 | 
			
		||||
      containerClasses,
 | 
			
		||||
      contentClasses,
 | 
			
		||||
      buttonClasses
 | 
			
		||||
      buttonClasses,
 | 
			
		||||
      buttonId,
 | 
			
		||||
    } = this.props;
 | 
			
		||||
 | 
			
		||||
    let myStyle = {};
 | 
			
		||||
@@ -158,6 +159,7 @@ class CookieConsent extends Component {
 | 
			
		||||
        <button
 | 
			
		||||
          style={myButtonStyle}
 | 
			
		||||
          className={buttonClasses}
 | 
			
		||||
          id={buttonId}
 | 
			
		||||
          onClick={() => {
 | 
			
		||||
            this.accept();
 | 
			
		||||
          }}
 | 
			
		||||
@@ -194,6 +196,7 @@ CookieConsent.propTypes = {
 | 
			
		||||
  containerClasses: PropTypes.string,
 | 
			
		||||
  contentClasses: PropTypes.string,
 | 
			
		||||
  buttonClasses: PropTypes.string,
 | 
			
		||||
  buttonId: PropTypes.string,
 | 
			
		||||
  acceptOnScroll: PropTypes.bool,
 | 
			
		||||
  acceptOnScrollPercentage: PropTypes.number,
 | 
			
		||||
  extraCookieOptions: PropTypes.object
 | 
			
		||||
@@ -214,6 +217,7 @@ CookieConsent.defaultProps = {
 | 
			
		||||
  containerClasses: "",
 | 
			
		||||
  contentClasses: "",
 | 
			
		||||
  buttonClasses: "",
 | 
			
		||||
  buttonId: "",
 | 
			
		||||
  extraCookieOptions: {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user