import React from 'react';
import CookieBanner from '../src';
import {cookie} from '../src';

cookie('accepts-cookies', '');

const Example = React.createClass({

  propTypes: {},

  getInitialState() {
    return {
      dismissOnScroll: true
    };
  },

  resetCookies() {
    cookie('accepts-cookies', '');
    this.refresh();
  },

  toggleDismissOnScroll() {
    this.setState({ dismissOnScroll: !this.state.dismissOnScroll });
  },

  refresh() {
    this.setState({});
  },

  render() {
    return (
      <div style={{height: 2000, fontFamily: 'sans-serif'}}>
        <CookieBanner
          styles={{button: {color: 'blue'}}}
          dismissOnScroll={this.state.dismissOnScroll}
          message='your own custom message'
          link={{msg: 'link to cookie policy', url: 'http://nocookielaw.com/'}}
          buttonMessage='close button message'
          onAccept={this.refresh}/>

        <div style={{margin: 20}}>
          <p>accepts-cookies: {cookie('accepts-cookies') ? 'true' : 'false'}</p>
          <button onClick={this.toggleDismissOnScroll}>{this.state.dismissOnScroll ? 'Disable' : 'Activate'} "dismissOnScroll"</button>
          <button onClick={this.resetCookies}>Reset Cookies</button>
          <h2>Try dismissing with a scroll</h2>
        </div>
      </div>
    );
  }

});

React.render(<Example />, document.getElementById('container'));
@@ -43,38 +43,34 @@
 nner
- from '../src';%0Aimport %7B
+, %7B BannerContent, 
 cookie
+ 
 %7D fr
@@ -120,12 +120,12 @@
 ;%0A%0Ac
-onst
+lass
  Exa
@@ -133,86 +133,47 @@
 ple 
-= React.createClass(%7B%0A%0A  propTypes: %7B%7D,%0A%0A  getInitialState() %7B%0A    return
+extends React.Component %7B%0A%0A  state =
  %7B%0A
-  
     
@@ -200,17 +200,9 @@
 e%0A  
-  %7D;%0A  %7D,
+%7D
 %0A%0A  
@@ -213,18 +213,24 @@
 tCookies
-()
+ = () =%3E
  %7B%0A    c
@@ -278,25 +278,24 @@
 fresh();%0A  %7D
-,
 %0A%0A  toggleDi
@@ -307,18 +307,24 @@
 OnScroll
-()
+ = () =%3E
  %7B%0A    t
@@ -386,25 +386,24 @@
 roll %7D);%0A  %7D
-,
 %0A%0A  refresh(
@@ -401,18 +401,24 @@
  refresh
-()
+ = () =%3E
  %7B%0A    t
@@ -438,17 +438,16 @@
 %7B%7D);%0A  %7D
-,
 %0A%0A  rend
@@ -457,208 +457,280 @@
 ) %7B%0A
+%0A
     
-return (%0A      %3Cdiv style=%7B%7Bheight: 2000, fontFamily: 'sans-serif'%7D%7D%3E%0A        %3CCookieBanner%0A          styles=%7B%7Bbutton: %7Bcolor: 'blue'%7D%7D%7D%0A          dismissOnScroll=%7Bthis.state.dismissOnScroll%7D%0A    
+const %7B%0A      refresh, toggleDismissOnScroll, resetCookies,%0A      state: %7B dismissOnScroll %7D%0A    %7D = this;%0A%0A    const cookieProps = %7B%0A      dismissOnScroll,%0A      onAccept: refresh%0A    %7D;%0A%0A    const bannerContentProps = %7B%0A      styles: %7B button: %7B color: 'blue' %7D %7D,%0A
     
@@ -738,17 +738,18 @@
  message
-=
+: 
 'your ow
@@ -769,26 +769,24 @@
 age'
+,
 %0A      
-    link=%7B%7B
+link: %7B 
 msg:
@@ -845,15 +845,12 @@
 om/'
-%7D%7D%0A    
+ %7D,%0A
     
@@ -864,17 +864,18 @@
 nMessage
-=
+: 
 'close b
@@ -897,38 +897,323 @@
     
-      onAccept=%7Bthis.refresh%7D/
+%7D;%0A%0A    return (%0A      %3Cdiv style=%7B%7B height: 2000, fontFamily: 'sans-serif' %7D%7D%3E%0A%0A        %3CCookieBanner %7B...cookieProps%7D%3E%0A          %7B(onAccept) =%3E (%0A            %3Cdiv onClick=%7BonAccept%7D%3E%0A              %3CBannerContent %7B...bannerContentProps%7D onAccept=%7BonAccept%7D /%3E%0A            %3C/div%3E%0A          )%7D%0A        %3C/CookieBanner
 %3E%0A%0A 
@@ -1232,16 +1232,17 @@
 style=%7B%7B
+ 
 margin: 
@@ -1243,16 +1243,17 @@
 rgin: 20
+ 
 %7D%7D%3E%0A    
@@ -1356,21 +1356,16 @@
 nClick=%7B
-this.
 toggleDi
@@ -1383,20 +1383,22 @@
 ll%7D%3E
-%7Bthis.state.
+%0A            %7B
 dism
@@ -1452,16 +1452,27 @@
 nScroll%22
+%0A          
 %3C/button
@@ -1500,21 +1500,16 @@
 nClick=%7B
-this.
 resetCoo
@@ -1514,16 +1514,29 @@
 ookies%7D%3E
+%0A            
 Reset Co
@@ -1540,16 +1540,27 @@
  Cookies
+%0A          
 %3C/button
@@ -1620,24 +1620,25 @@
      %3C/div%3E%0A
+%0A
       %3C/div%3E
@@ -1651,18 +1651,16 @@
 ;%0A  %7D%0A%0A%7D
-);
 %0A%0AReact.
@@ -1717,8 +1717,9 @@
 iner'));
+%0A

update examples