Browse Source

adding

master
Björn 4 years ago
parent
commit
54be6d90bc
6 changed files with 36 additions and 27 deletions
  1. +6
    -15
      demo.js
  2. +23
    -5
      demo.scss
  3. +1
    -1
      dist/css/demo.css
  4. +1
    -1
      dist/js/demo.js
  5. +4
    -4
      src/TinyConsent.riot
  6. +1
    -1
      src/TinyConsentButton.riot

+ 6
- 15
demo.js View File

@ -5,12 +5,12 @@ import TinyConsentButton from './src/TinyConsentButton.riot';
riot.register('tiny-consent', TinyConsent); riot.register('tiny-consent', TinyConsent);
riot.register('tiny-consent-button', TinyConsentButton); riot.register('tiny-consent-button', TinyConsentButton);
const consent = {
const data = {
cookies: [{ cookies: [{
title: 'Matomo', title: 'Matomo',
name: 'matamo_', name: 'matamo_',
id: 'matamo', id: 'matamo',
content: 'Analyse des Benutzerverhaltens, damit helfen Sie uns diese Seite zu verbessern.',
content: '',
handleAgree: function() { handleAgree: function() {
console.log('agree'); console.log('agree');
}, },
@ -18,21 +18,12 @@ const consent = {
console.log('reject'); console.log('reject');
} }
},{ },{
id: 'wordpress2',
name: 'wordpress2_',
content: 'Wordpress und WooCommerce nutzen Session, diese werden zum einen für den Login genutzt, aber auch für den Warenkorb.',
essential: true
},{
id: 'wordpress12',
name: 'wordpress12_',
content: 'Wordpress und WooCommerce nutzen Session, diese werden zum einen für den Login genutzt, aber auch für den Warenkorb.',
essential: true
},{
id: 'wordpress3',
name: 'wordpress3_',
id: 'wordpress',
name: 'wordpress_',
content: 'Wordpress und WooCommerce nutzen Session, diese werden zum einen für den Login genutzt, aber auch für den Warenkorb.', content: 'Wordpress und WooCommerce nutzen Session, diese werden zum einen für den Login genutzt, aber auch für den Warenkorb.',
essential: true essential: true
}] }]
}; };
riot.mount('tiny-consent', consent);
riot.mount('tiny-consent', data);
riot.mount('tiny-consent-button'); riot.mount('tiny-consent-button');

+ 23
- 5
demo.scss View File

@ -4,12 +4,30 @@
* *
*/ */
.tiny-consent__content {
display: none;
}
.tiny-consent {
&__banner {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: auto;
margin: 1em;
}
&__cookies {
margin: 0;
padding: 0;
}
&__content {
display: none;
}
.tiny-consent__cookie {
display: none;
&__cookie {
display: none;
}
} }
.show { .show {


+ 1
- 1
dist/css/demo.css View File

@ -1 +1 @@
.tiny-consent__content,.tiny-consent__cookie{display:none}.show{display:block}
.tiny-consent__banner{position:fixed;left:0;bottom:0;width:100%;height:auto;margin:1em}.tiny-consent__cookies{margin:0;padding:0}.tiny-consent__content,.tiny-consent__cookie{display:none}.show{display:block}

+ 1
- 1
dist/js/demo.js
File diff suppressed because it is too large
View File


+ 4
- 4
src/TinyConsent.riot View File

@ -1,5 +1,5 @@
<tiny-consent> <tiny-consent>
<div class="tiny-consent">
<div id="tiny-consent" class="tiny-consent">
<div class="tiny-consent__banner"> <div class="tiny-consent__banner">
<div class={ state.isOpen === true ? 'tiny-consent__content show' : 'tiny-consent__content' }> <div class={ state.isOpen === true ? 'tiny-consent__content show' : 'tiny-consent__content' }>
<p> <p>
@ -29,7 +29,7 @@
</div> </div>
</li> </li>
</ul> </ul>
<div class="tiny-consent__close">
<div if={ state.hasChanged === false } class="tiny-consent__close">
<button class="button button--submit tiny-consent__button" onclick={ handleClose }> <button class="button button--submit tiny-consent__button" onclick={ handleClose }>
{ state.options.messages.close } { state.options.messages.close }
</button> </button>
@ -236,8 +236,8 @@
updateEssential() updateEssential()
{ {
// set true for last essential cookie where consent is not already set // set true for last essential cookie where consent is not already set
for (let i = (this.props.cookies.length - 1); i > 0; i--) {
if ((this.props.cookies[i].hasConsent === false && this.props.cookies[i].essential === true) || (this.state.hasChanged === false && this.props.cookies[i].essential === true)) {
for (let i = (this.props.cookies.length - 1); i >= 0; i--) {
if ((this.state.hasChanged === true && this.props.cookies[i].hasConsent === false && this.props.cookies[i].essential === true) || (this.state.hasChanged === false && this.props.cookies[i].essential === true)) {
this.props.cookies[i].essentialLast = true; this.props.cookies[i].essentialLast = true;
break; break;
} }


+ 1
- 1
src/TinyConsentButton.riot View File

@ -1,5 +1,5 @@
<tiny-consent-button> <tiny-consent-button>
<div class="tiny-consent-button">
<div id="tiny-consent-button" class="tiny-consent-button">
<button class="button tiny-consent-button__button" onclick={ handleOpen }> <button class="button tiny-consent-button__button" onclick={ handleOpen }>
{ state.options.messages.open } { state.options.messages.open }
</button> </button>


Loading…
Cancel
Save