'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _react3 = require('@storybook/react');

var _addonKnobs = require('@storybook/addon-knobs');

var _addonActions = require('@storybook/addon-actions');

var _index = require('./index');

var _index2 = _interopRequireDefault(_index);

var _MainNav = require('./MainNav.md');

var _MainNav2 = _interopRequireDefault(_MainNav);

var _MainNavKnob = require('./MainNav.knob.options');

var _MainNavKnob2 = _interopRequireDefault(_MainNavKnob);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _react3.storiesOf)('molecules', module).addDecorator((0, _addonKnobs.withKnobs)({ escapeHTML: false })).add('MainNav', function () {
  var newProps = {
    onNavigateCallBack: (0, _addonActions.action)('onNavigateCallBack'),
    mainNav: []
  };
  newProps.mainNav = _MainNavKnob2.default.mainNav.map(function (nav, navIndex) {
    var active = false;
    if (typeof nav.active === 'string') {
      active = nav.active.toLowerCase() === 'true';
    } else if (typeof nav.active === 'boolean') {
      active = nav.active;
    } else {
      active = false;
    }
    var storyProps = {
      href: (0, _addonKnobs.text)('MainNav ' + navIndex + ': href', nav.href, 'MainNav ' + navIndex),
      text: (0, _addonKnobs.text)('MainNav ' + navIndex + ': text', nav.text, 'MainNav ' + navIndex),
      active: (0, _addonKnobs.boolean)('MainNav ' + navIndex + ': active', active, 'MainNav ' + navIndex),
      subNav: (0, _addonKnobs.object)('MainNav ' + navIndex + ': subNav', nav.subNav, 'MainNav ' + navIndex)
    };
    return storyProps;
  });
  return _react2.default.createElement(_index2.default, newProps);
}, { info: _MainNav2.default });