diff --git a/CHANGELOG.md b/CHANGELOG.md index 474b9ab..d24e8d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [[7.5.0]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.5.0) + +- Added `customDeclineButtonProps` to add custom properties to the decline button + ## [[7.4.1]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.4.1) - Small version error in package.json that actually didn't make it work with React 18 diff --git a/README.md b/README.md index c74f769..3bd6c05 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,7 @@ That option would be interesting if you want to allow user to change their conse | onOverlayClick | function | `() => {}` | allows you to react to a click on the overlay | | acceptOnOverlayClick | boolean | false | Determines whether the cookies should be accepted after clicking on the overlay | | customButtonProps | object | `{}` | Allows you to set custom props on the button component | +| customDeclineButtonProps | object | `{}` | Allows you to set custom props on the decline button component | ## Debugging it diff --git a/src/index.d.ts b/src/index.d.ts index 4f3fcb8..f493a8f 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -48,6 +48,7 @@ export interface CookieConsentProps { customContentAttributes?: object; customContainerAttributes?: object; customButtonProps?: object; + customDeclineButtonProps?: object; } export default class CookieConsent extends React.Component {} diff --git a/src/index.js b/src/index.js index eacf748..251e022 100644 --- a/src/index.js +++ b/src/index.js @@ -293,6 +293,7 @@ class CookieConsent extends Component { customContainerAttributes, customContentAttributes, customButtonProps, + customDeclineButtonProps, } = this.props; let myStyle = {}; @@ -352,6 +353,7 @@ class CookieConsent extends Component { onClick={() => { this.decline(); }} + {...customDeclineButtonProps} > {declineButtonText} @@ -360,7 +362,6 @@ class CookieConsent extends Component { // add accept button buttonsToRender.push( { this.accept(); }} + {...customButtonProps} > {buttonText} @@ -455,6 +457,7 @@ CookieConsent.propTypes = { customContentAttributes: PropTypes.object, customContainerAttributes: PropTypes.object, customButtonProps: PropTypes.object, + customDeclineButtonProps: PropTypes.object, }; CookieConsent.defaultProps = { @@ -497,6 +500,7 @@ CookieConsent.defaultProps = { customContentAttributes: {}, customContainerAttributes: {}, customButtonProps: {}, + customDeclineButtonProps: {}, }; export default CookieConsent;