import React from 'react'
import { configure, addDecorator } from '@storybook/react';
import '@storybook/addon-console';
import { withKnobsOptions } from '@storybook/addon-knobs/react';
import centered from '@storybook/addon-centered';
import { checkA11y } from '@storybook/addon-a11y';
//import {muiTheme} from 'storybook-addon-material-ui';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
addDecorator(centered)
//import getMuiTheme from 'material-ui/styles/getMuiTheme';

/*
const newTheme = {
    themeName: 'Prime Panel',
    palette: {
        primary1Color: '#dd712f',
        //alternateTextColor: '#4a4a4a',
        //canvasColor: '#616161',
        //textColor: '#bdbdbd',
        //secondaryTextColor: 'rgba(255, 255, 255, 0.54)',
        //disabledColor: '#757575',
        ///accent1Color: '#607d8b',
    },
}*/
/*
const muiTheme = getMuiTheme({
  palette: {
    primary1Color: '#dd712f'
  },
}, {
  avatar: {
    borderColor: null,
  },
  userAgent: 'all'
});
*/

addDecorator( storyFn => (
  <div>
    { storyFn() }
  </div>
))
addDecorator( storyFn => (
  <MuiThemeProvider /*muiTheme={muiTheme}*/>
    { storyFn() }
  </MuiThemeProvider>
))
addDecorator(checkA11y)
// addDecorator(centered)
addDecorator(withKnobsOptions({
	//debounce: { wait: 100, leading: false }, // Same as lodash debounce.
	timestamps: true // Doesn't emit events while user is typing.
}))

// automatically import all files named story.js
const req = require.context('../ReactComponents', true, /story.js$/);
function loadStories() {
  req.keys().forEach((filename) => req(filename));
}

configure(loadStories, module);
