mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-08-23 17:44:55 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
ecb5f30a7c | |||
|
d1c7252546 | ||
602a9bfe62 | |||
c9a6e1f0ce |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -5,6 +5,19 @@ 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/),
|
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).
|
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
|
||||||
|
- Updated example and codebase to use React 18
|
||||||
|
|
||||||
## [[7.3.1]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.3.1)
|
## [[7.3.1]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.3.1)
|
||||||
|
|
||||||
- Added type annotations on public functions
|
- Added type annotations on public functions
|
||||||
|
@@ -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 |
|
| 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 |
|
| 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 |
|
| 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
|
## Debugging it
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
5764
package-lock.json
generated
5764
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@@ -4,7 +4,7 @@
|
|||||||
"name": "Rick van Lieshout",
|
"name": "Rick van Lieshout",
|
||||||
"email": "info@rickvanlieshout.com"
|
"email": "info@rickvanlieshout.com"
|
||||||
},
|
},
|
||||||
"version": "7.3.1",
|
"version": "7.4.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",
|
||||||
"types": "build/index.d.ts",
|
"types": "build/index.d.ts",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"prop-types": "^15.7.2"
|
"prop-types": "^15.7.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.13.1 || ^17.0.0"
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
@@ -43,22 +43,22 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/Mastermindzh/react-cookie-consent#readme",
|
"homepage": "https://github.com/Mastermindzh/react-cookie-consent#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.12.1",
|
"@babel/cli": "^7.17.6",
|
||||||
"@babel/core": "^7.12.3",
|
"@babel/core": "^7.17.8",
|
||||||
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
|
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
|
||||||
"@babel/plugin-transform-object-assign": "^7.12.1",
|
"@babel/plugin-transform-object-assign": "^7.16.7",
|
||||||
"@babel/plugin-transform-react-jsx": "^7.12.1",
|
"@babel/plugin-transform-react-jsx": "^7.17.3",
|
||||||
"@babel/preset-env": "^7.12.1",
|
"@babel/preset-env": "^7.16.11",
|
||||||
"@mastermindzh/prettier-config": "^1.0.0",
|
"@mastermindzh/prettier-config": "^1.0.0",
|
||||||
"@types/js-cookie": "^2.2.6",
|
"@types/js-cookie": "^2.2.6",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.2.4",
|
||||||
"copy-webpack-plugin": "^6.2.1",
|
"copy-webpack-plugin": "^6.2.1",
|
||||||
"husky": "^4.3.0",
|
"husky": "^4.3.0",
|
||||||
"lint-staged": "^10.5.1",
|
"lint-staged": "^10.5.1",
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.6.2",
|
||||||
"react": "^16.13.1",
|
"react": "^18.0.0",
|
||||||
"webpack": "^5.3.2",
|
"webpack": "^5.71.0",
|
||||||
"webpack-cli": "^4.1.0"
|
"webpack-cli": "^4.9.2"
|
||||||
},
|
},
|
||||||
"prettier": "@mastermindzh/prettier-config",
|
"prettier": "@mastermindzh/prettier-config",
|
||||||
"husky": {
|
"husky": {
|
||||||
|
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@@ -48,6 +48,7 @@ export interface CookieConsentProps {
|
|||||||
customContentAttributes?: object;
|
customContentAttributes?: object;
|
||||||
customContainerAttributes?: object;
|
customContainerAttributes?: object;
|
||||||
customButtonProps?: object;
|
customButtonProps?: object;
|
||||||
|
customDeclineButtonProps?: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
||||||
|
@@ -293,6 +293,7 @@ class CookieConsent extends Component {
|
|||||||
customContainerAttributes,
|
customContainerAttributes,
|
||||||
customContentAttributes,
|
customContentAttributes,
|
||||||
customButtonProps,
|
customButtonProps,
|
||||||
|
customDeclineButtonProps,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
let myStyle = {};
|
let myStyle = {};
|
||||||
@@ -352,6 +353,7 @@ class CookieConsent extends Component {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.decline();
|
this.decline();
|
||||||
}}
|
}}
|
||||||
|
{...customDeclineButtonProps}
|
||||||
>
|
>
|
||||||
{declineButtonText}
|
{declineButtonText}
|
||||||
</ButtonComponent>
|
</ButtonComponent>
|
||||||
@@ -360,7 +362,6 @@ class CookieConsent extends Component {
|
|||||||
// add accept button
|
// add accept button
|
||||||
buttonsToRender.push(
|
buttonsToRender.push(
|
||||||
<ButtonComponent
|
<ButtonComponent
|
||||||
{...customButtonProps}
|
|
||||||
key="acceptButton"
|
key="acceptButton"
|
||||||
style={myButtonStyle}
|
style={myButtonStyle}
|
||||||
className={buttonClasses}
|
className={buttonClasses}
|
||||||
@@ -369,6 +370,7 @@ class CookieConsent extends Component {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.accept();
|
this.accept();
|
||||||
}}
|
}}
|
||||||
|
{...customButtonProps}
|
||||||
>
|
>
|
||||||
{buttonText}
|
{buttonText}
|
||||||
</ButtonComponent>
|
</ButtonComponent>
|
||||||
@@ -455,6 +457,7 @@ CookieConsent.propTypes = {
|
|||||||
customContentAttributes: PropTypes.object,
|
customContentAttributes: PropTypes.object,
|
||||||
customContainerAttributes: PropTypes.object,
|
customContainerAttributes: PropTypes.object,
|
||||||
customButtonProps: PropTypes.object,
|
customButtonProps: PropTypes.object,
|
||||||
|
customDeclineButtonProps: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
CookieConsent.defaultProps = {
|
CookieConsent.defaultProps = {
|
||||||
@@ -497,6 +500,7 @@ CookieConsent.defaultProps = {
|
|||||||
customContentAttributes: {},
|
customContentAttributes: {},
|
||||||
customContainerAttributes: {},
|
customContainerAttributes: {},
|
||||||
customButtonProps: {},
|
customButtonProps: {},
|
||||||
|
customDeclineButtonProps: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CookieConsent;
|
export default CookieConsent;
|
||||||
|
Reference in New Issue
Block a user