mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-08-23 09:35:04 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1ad4474d93 | ||
|
6a5aac9cd7 | ||
c656e311e6 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
build/index.js.LICENSE.txt
|
||||||
|
16
README.md
16
README.md
@@ -25,13 +25,13 @@ Example branch: https://github.com/Mastermindzh/react-cookie-consent/tree/exampl
|
|||||||
- [Why are there two cookies? One of which named "Legacy"](#why-are-there-two-cookies--one-of-which-named--legacy-)
|
- [Why are there two cookies? One of which named "Legacy"](#why-are-there-two-cookies--one-of-which-named--legacy-)
|
||||||
- [Styling it](#styling-it)
|
- [Styling it](#styling-it)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
- [changing the bar background to red](#changing-the-bar-background-to-red)
|
- [Changing the bar background to red](#changing-the-bar-background-to-red)
|
||||||
- [changing the button font-weight to bold](#changing-the-button-font-weight-to-bold)
|
- [Changing the button font-weight to bold](#changing-the-button-font-weight-to-bold)
|
||||||
- [Using predefined CSS classes](#using-predefined-css-classes)
|
- [Using predefined CSS classes](#using-predefined-css-classes)
|
||||||
- [Flipping the buttons](#flipping-the-buttons)
|
- [Flipping the buttons](#flipping-the-buttons)
|
||||||
- [Extra cookie options](#extra-cookie-options)
|
- [Extra cookie options](#extra-cookie-options)
|
||||||
- [rainbows!](#rainbows)
|
- [Rainbows!](#rainbows)
|
||||||
- [contributor information](#contributor-information)
|
- [Contributor information](#contributor-information)
|
||||||
- [Projects using react-cookie-consent](#projects-using-react-cookie-consent)
|
- [Projects using react-cookie-consent](#projects-using-react-cookie-consent)
|
||||||
|
|
||||||
<!-- tocstop -->
|
<!-- tocstop -->
|
||||||
@@ -186,13 +186,13 @@ You can use `disableStyles={true}` to disable any built-in styling.
|
|||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
#### changing the bar background to red
|
#### Changing the bar background to red
|
||||||
|
|
||||||
```js
|
```js
|
||||||
<CookieConsent style={{ background: "red" }}></CookieConsent>
|
<CookieConsent style={{ background: "red" }}></CookieConsent>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### changing the button font-weight to bold
|
#### Changing the button font-weight to bold
|
||||||
|
|
||||||
```js
|
```js
|
||||||
<CookieConsent buttonStyle={{ fontWeight: "bold" }}></CookieConsent>
|
<CookieConsent buttonStyle={{ fontWeight: "bold" }}></CookieConsent>
|
||||||
@@ -241,7 +241,7 @@ You can add more cookie options using the extraCookieOptions parameter like so:
|
|||||||
<CookieConsent extraCookieOptions={{ domain: "myexample.com" }}>cookie bar</CookieConsent>
|
<CookieConsent extraCookieOptions={{ domain: "myexample.com" }}>cookie bar</CookieConsent>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### rainbows!
|
#### Rainbows!
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ You can also generate a page-obfuscating overlay that will prevent actions other
|
|||||||
[contentstyle]: https://github.com/Mastermindzh/react-cookie-consent/blob/master/src/index.js#L52-L55
|
[contentstyle]: https://github.com/Mastermindzh/react-cookie-consent/blob/master/src/index.js#L52-L55
|
||||||
[overlaystyle]: https://github.com/Mastermindzh/react-cookie-consent/blob/master/src/index.js#L62-L69
|
[overlaystyle]: https://github.com/Mastermindzh/react-cookie-consent/blob/master/src/index.js#L62-L69
|
||||||
|
|
||||||
## contributor information
|
## Contributor information
|
||||||
|
|
||||||
When making a PR please think about the following things:
|
When making a PR please think about the following things:
|
||||||
|
|
||||||
|
4
build/index.d.ts
vendored
4
build/index.d.ts
vendored
@@ -12,7 +12,7 @@ export interface CookieConsentProps {
|
|||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
disableStyles?: boolean;
|
disableStyles?: boolean;
|
||||||
hideOnAccept?: boolean;
|
hideOnAccept?: boolean;
|
||||||
onAccept?: ({ acceptedByScrolling }: { acceptedByScrolling?: boolean }) => void;
|
onAccept?: Function;
|
||||||
onDecline?: Function;
|
onDecline?: Function;
|
||||||
buttonText?: Function | React.ReactNode;
|
buttonText?: Function | React.ReactNode;
|
||||||
declineButtonText?: Function | React.ReactNode;
|
declineButtonText?: Function | React.ReactNode;
|
||||||
@@ -29,8 +29,6 @@ export interface CookieConsentProps {
|
|||||||
declineButtonClasses?: string;
|
declineButtonClasses?: string;
|
||||||
buttonId?: string;
|
buttonId?: string;
|
||||||
declineButtonId?: string;
|
declineButtonId?: string;
|
||||||
acceptOnScroll?: boolean;
|
|
||||||
acceptOnScrollPercentage?: number;
|
|
||||||
extraCookieOptions?: object;
|
extraCookieOptions?: object;
|
||||||
disableButtonStyles?: boolean;
|
disableButtonStyles?: boolean;
|
||||||
enableDeclineButton?: boolean;
|
enableDeclineButton?: boolean;
|
||||||
|
2997
build/index.js
2997
build/index.js
File diff suppressed because it is too large
Load Diff
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-cookie-consent",
|
"name": "react-cookie-consent",
|
||||||
"version": "5.2.0",
|
"version": "6.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "Rick van Lieshout",
|
"name": "Rick van Lieshout",
|
||||||
"email": "info@rickvanlieshout.com"
|
"email": "info@rickvanlieshout.com"
|
||||||
},
|
},
|
||||||
"version": "5.2.0",
|
"version": "6.0.0",
|
||||||
"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"
|
"react": "^16.13.1 || ^17.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
|
2
src/index.d.ts
vendored
2
src/index.d.ts
vendored
@@ -12,7 +12,7 @@ export interface CookieConsentProps {
|
|||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
disableStyles?: boolean;
|
disableStyles?: boolean;
|
||||||
hideOnAccept?: boolean;
|
hideOnAccept?: boolean;
|
||||||
onAccept?: () => void;
|
onAccept?: Function;
|
||||||
onDecline?: Function;
|
onDecline?: Function;
|
||||||
buttonText?: Function | React.ReactNode;
|
buttonText?: Function | React.ReactNode;
|
||||||
declineButtonText?: Function | React.ReactNode;
|
declineButtonText?: Function | React.ReactNode;
|
||||||
|
@@ -28,7 +28,6 @@ const ConditionalWrapper = ({ condition, wrapper, children }) => {
|
|||||||
class CookieConsent extends Component {
|
class CookieConsent extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.accept.bind(this);
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -281,7 +280,9 @@ class CookieConsent extends Component {
|
|||||||
className={buttonClasses}
|
className={buttonClasses}
|
||||||
id={buttonId}
|
id={buttonId}
|
||||||
aria-label={ariaAcceptLabel}
|
aria-label={ariaAcceptLabel}
|
||||||
onClick={this.accept}
|
onClick={() => {
|
||||||
|
this.accept();
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{buttonText}
|
{buttonText}
|
||||||
</ButtonComponent>
|
</ButtonComponent>
|
||||||
|
Reference in New Issue
Block a user