import React from 'react';
import { storiesOf } from '@storybook/react';
import {
  text, array
} from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import { State, Store } from '@sambego/storybook-state';
import SimpleColorPicker from './simple-color-picker';
import { notes, info } from './documentation';

const store = new Store({
  selectedColor: '#00DC00'
});

const onChange = (e) => {
  store.set({
    selectedColor: e.target.value
  });
  action('select')();
};


storiesOf('SimpleColorPicker', module)
  .addParameters({
    info: {
      propTablesExclude: [State]
    }
  })

  .add('default', () => {
    const name = text('name', 'basicPicker');
    const availableColors = array('availableColors', ['#00DC00', '#255BC7', '#ED1C5F']);

    return (
      <State store={ store }>
        <SimpleColorPicker
          availableColors={ availableColors }
          name={ name }
          onChange={ onChange }

        />
      </State>
    );
  }, {
    notes: { markdown: notes },
    info: { text: info }
  });

@@ -74,18 +74,16 @@
 import %7B
-%0A 
  text, a
@@ -86,17 +86,17 @@
 t, array
-%0A
+ 
 %7D from '
@@ -495,17 +495,16 @@
 ();%0A%7D;%0A%0A
-%0A
 storiesO
@@ -617,16 +617,21 @@
 %0A  .add(
+%0A    
 'default
@@ -632,16 +632,20 @@
 efault',
+%0A   
  () =%3E %7B
@@ -645,16 +645,18 @@
 () =%3E %7B%0A
+  
     cons
@@ -693,16 +693,18 @@
 cker');%0A
+  
     cons
@@ -789,16 +789,18 @@
 );%0A%0A    
+ 
+ 
 return (
@@ -800,16 +800,18 @@
 eturn (%0A
+  
       %3CS
@@ -840,16 +840,18 @@
         
+  
 %3CSimpleC
@@ -861,16 +861,18 @@
 rPicker%0A
+  
         
@@ -908,26 +908,16 @@
 Colors %7D
-%0A         
  name=%7B 
@@ -923,16 +923,18 @@
  name %7D%0A
+  
         
@@ -957,25 +957,25 @@
 hange %7D%0A
-%0A
+ 
         
 /%3E%0A     
@@ -970,11 +970,14 @@
     
+ 
 /%3E%0A
+  
     
@@ -995,18 +995,28 @@
     
+  
 );%0A
+  
   %7D,
+%0A   
  %7B%0A
+  
     
@@ -1043,24 +1043,26 @@
 otes %7D,%0A    
+ 
+ 
 info: %7B text
@@ -1072,12 +1072,17 @@
 nfo %7D%0A  
-%7D
+  %7D%0A  
 );%0A

update simple color picker