Skip to content

Fixes "decline" button not showing (fixes issue #29) #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ React.renderComponent(
| **statisticsOptionText** | string | "Statistics" | *optional*. Text for the *statistics* cookies checkbox |
| **marketingOptionText** | string | "Marketing" | *optional*. Text for the *marketing* cookies checkbox |
| **acceptButtonText** | string | "Accept" | *optional*. Text for the *accept* button |
| **declineButtonText** | string | "Decline" | *optional*. Text for the *decline* button |
| **managePreferencesButtonText** | string | "Decline" | *optional*. Text for the *manage preferences* button |
| **savePreferencesButtonText** | string | "Decline" | *optional*. Text for the save and close* button |
| **declineButtonText** | string | "Decline all" | *optional*. Text for the *decline* button |
| **managePreferencesButtonText** | string | "Manage my cookies" | *optional*. Text for the *manage preferences* button |
| **savePreferencesButtonText** | string | "Save and close" | *optional*. Text for the save and close* button |
| **showDeclineButton** | bool | false | *optional*. Show or hide the *decline* button |
| **dismissOnScroll** | bool | false | *optional*. Enable or disable the dismissing on scroll of the banner |
| **showPreferencesOption** | bool | true | *optional*. Show or hide the *preferences* checkbox |
Expand Down
9 changes: 9 additions & 0 deletions src/components/CookieBannerContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class CookieBannerContent extends React.Component {
savePreferencesButtonText = 'Save and close',
onConfirm = () => {},
onAcceptAll = () => {},
showDeclineButton = false,
declineButtonText = 'Decline all',
onDecline = () => {},
} = this.props;

const { showPreferences } = this.state;
Expand Down Expand Up @@ -62,6 +65,12 @@ class CookieBannerContent extends React.Component {
<button type="button" className="react-cookie-law-accept-btn" style={buttonStyle} onClick={() => onAcceptAll()}>
<span>{acceptButtonText}</span>
</button>
{
showDeclineButton && (
<button type="button" className="react-cookie-law-accept-btn" style={buttonStyle} onClick={() => onDecline()}>
<span>{declineButtonText}</span>
</button>
)}
</div>
</div>
</div>
Expand Down