mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-08-23 17:44:55 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
541194819b | ||
91d86af611 |
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
build/*
|
@@ -5,6 +5,15 @@ 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).
|
||||||
|
|
||||||
|
## [next]
|
||||||
|
|
||||||
|
- added `customButtonProps` that allows to use custom props with the button component. Specifically useful for library buttons components, for e.g. MUI Button.
|
||||||
|
|
||||||
|
## [[7.2.1]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.2.1)
|
||||||
|
|
||||||
|
- hideOnDecline added to typescript files
|
||||||
|
- Added .prettieringore
|
||||||
|
|
||||||
## [[7.2.0]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.2.0)
|
## [[7.2.0]](https://github.com/Mastermindzh/react-cookie-consent/releases/tag/7.2.0)
|
||||||
|
|
||||||
- Added `onOverlayClick` which allows you to react to a click on the overlay
|
- Added `onOverlayClick` which allows you to react to a click on the overlay
|
||||||
|
@@ -183,6 +183,7 @@ That option would be interesting if you want to allow user to change their conse
|
|||||||
| customContainerAttributes | object | `{}` | Allows you to set custom (data) attributes on the container div |
|
| customContainerAttributes | object | `{}` | Allows you to set custom (data) attributes on the container div |
|
||||||
| 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 |
|
||||||
|
|
||||||
## Debugging it
|
## Debugging it
|
||||||
|
|
||||||
|
1
build/index.d.ts
vendored
1
build/index.d.ts
vendored
@@ -13,6 +13,7 @@ export interface CookieConsentProps {
|
|||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
disableStyles?: boolean;
|
disableStyles?: boolean;
|
||||||
hideOnAccept?: boolean;
|
hideOnAccept?: boolean;
|
||||||
|
hideOnDecline?: boolean;
|
||||||
onAccept?: (acceptedByScrolling?: boolean) => void;
|
onAccept?: (acceptedByScrolling?: boolean) => void;
|
||||||
onDecline?: Function;
|
onDecline?: Function;
|
||||||
buttonText?: Function | React.ReactNode;
|
buttonText?: Function | React.ReactNode;
|
||||||
|
791
build/index.js
791
build/index.js
File diff suppressed because one or more lines are too long
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "react-cookie-consent",
|
"name": "react-cookie-consent",
|
||||||
"version": "7.2.0",
|
"version": "7.2.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "7.2.0",
|
"version": "7.2.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "Rick van Lieshout",
|
"name": "Rick van Lieshout",
|
||||||
"email": "info@rickvanlieshout.com"
|
"email": "info@rickvanlieshout.com"
|
||||||
},
|
},
|
||||||
"version": "7.2.0",
|
"version": "7.2.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",
|
||||||
|
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@@ -47,6 +47,7 @@ export interface CookieConsentProps {
|
|||||||
acceptOnScrollPercentage?: number;
|
acceptOnScrollPercentage?: number;
|
||||||
customContentAttributes?: object;
|
customContentAttributes?: object;
|
||||||
customContainerAttributes?: object;
|
customContainerAttributes?: object;
|
||||||
|
customButtonProps?: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
|
||||||
|
@@ -292,6 +292,7 @@ class CookieConsent extends Component {
|
|||||||
ariaDeclineLabel,
|
ariaDeclineLabel,
|
||||||
customContainerAttributes,
|
customContainerAttributes,
|
||||||
customContentAttributes,
|
customContentAttributes,
|
||||||
|
customButtonProps,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
let myStyle = {};
|
let myStyle = {};
|
||||||
@@ -359,6 +360,7 @@ 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}
|
||||||
@@ -452,6 +454,7 @@ CookieConsent.propTypes = {
|
|||||||
acceptOnScrollPercentage: PropTypes.number,
|
acceptOnScrollPercentage: PropTypes.number,
|
||||||
customContentAttributes: PropTypes.object,
|
customContentAttributes: PropTypes.object,
|
||||||
customContainerAttributes: PropTypes.object,
|
customContainerAttributes: PropTypes.object,
|
||||||
|
customButtonProps: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
CookieConsent.defaultProps = {
|
CookieConsent.defaultProps = {
|
||||||
@@ -493,6 +496,7 @@ CookieConsent.defaultProps = {
|
|||||||
acceptOnScrollPercentage: 25,
|
acceptOnScrollPercentage: 25,
|
||||||
customContentAttributes: {},
|
customContentAttributes: {},
|
||||||
customContainerAttributes: {},
|
customContainerAttributes: {},
|
||||||
|
customButtonProps: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CookieConsent;
|
export default CookieConsent;
|
||||||
|
Reference in New Issue
Block a user