3 Commits
7.4.1 ... 7.5.0

Author SHA1 Message Date
ecb5f30a7c Added to add custom properties to the decline button 2022-06-18 14:29:39 +02:00
dependabot[bot]
d1c7252546 Bump semver-regex from 3.1.3 to 3.1.4 (#158)
Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/commits/v3.1.4)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-06 09:25:54 +02:00
602a9bfe62 release 7.4.1 2022-04-03 10:30:45 +02:00
6 changed files with 26 additions and 12 deletions

View File

@@ -5,6 +5,14 @@ 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
## [[7.4.0]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.4.0)
- Added support for React 18

View File

@@ -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

18
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "react-cookie-consent",
"version": "7.4.0",
"version": "7.4.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "react-cookie-consent",
"version": "7.4.0",
"version": "7.4.1",
"license": "MIT",
"dependencies": {
"js-cookie": "^2.2.1",
@@ -31,7 +31,7 @@
"webpack-cli": "^4.9.2"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0 | ^18.0.0"
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/@ampproject/remapping": {
@@ -5014,9 +5014,9 @@
"dev": true
},
"node_modules/semver-regex": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.3.tgz",
"integrity": "sha512-Aqi54Mk9uYTjVexLnR67rTyBusmwd04cLkHy9hNvk3+G3nT2Oyg7E0l4XVbOaNwIvQ3hHeYxGcyEy+mKreyBFQ==",
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.4.tgz",
"integrity": "sha512-6IiqeZNgq01qGf0TId0t3NvKzSvUsjcpdEO3AQNeIjR6A2+ckTnQlDpl4qu1bjRv0RzN3FP9hzFmws3lKqRWkA==",
"dev": true,
"engines": {
"node": ">=8"
@@ -9459,9 +9459,9 @@
"dev": true
},
"semver-regex": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.3.tgz",
"integrity": "sha512-Aqi54Mk9uYTjVexLnR67rTyBusmwd04cLkHy9hNvk3+G3nT2Oyg7E0l4XVbOaNwIvQ3hHeYxGcyEy+mKreyBFQ==",
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.4.tgz",
"integrity": "sha512-6IiqeZNgq01qGf0TId0t3NvKzSvUsjcpdEO3AQNeIjR6A2+ckTnQlDpl4qu1bjRv0RzN3FP9hzFmws3lKqRWkA==",
"dev": true
},
"serialize-javascript": {

View File

@@ -4,7 +4,7 @@
"name": "Rick van Lieshout",
"email": "info@rickvanlieshout.com"
},
"version": "7.4.0",
"version": "7.4.1",
"description": "A small, simple and customizable cookie consent bar for use in React applications.",
"main": "build/index.js",
"types": "build/index.d.ts",
@@ -13,7 +13,7 @@
"prop-types": "^15.7.2"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0 | ^18.0.0"
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
},
"scripts": {
"build": "webpack",

1
src/index.d.ts vendored
View File

@@ -48,6 +48,7 @@ export interface CookieConsentProps {
customContentAttributes?: object;
customContainerAttributes?: object;
customButtonProps?: object;
customDeclineButtonProps?: object;
}
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}

View File

@@ -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}
</ButtonComponent>
@@ -360,7 +362,6 @@ class CookieConsent extends Component {
// add accept button
buttonsToRender.push(
<ButtonComponent
{...customButtonProps}
key="acceptButton"
style={myButtonStyle}
className={buttonClasses}
@@ -369,6 +370,7 @@ class CookieConsent extends Component {
onClick={() => {
this.accept();
}}
{...customButtonProps}
>
{buttonText}
</ButtonComponent>
@@ -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;