'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

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

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

var _index2 = _interopRequireDefault(_index);

var _item = require('./item');

var _item2 = _interopRequireDefault(_item);

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

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

var getLink = function getLink() {
  var sampleText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Sample Link';
  var index = arguments[1];

  var linkProps = {
    text: (0, _addonKnobs.text)('Breadcrumb ' + index + ': text', sampleText, 'Breadcrumb ' + index),
    href: (0, _addonKnobs.text)('Breadcrumb ' + index + ': href', 'http://www.mass.gov/', 'Breadcrumb ' + index),
    icon: null
  };
  return _react2.default.createElement(_index3.Link, linkProps);
};

var getItem = function getItem(itemText, index, currentPage) {
  return _react2.default.createElement(
    _item2.default,
    { currentPage: currentPage },
    getLink(itemText, index)
  );
};

(0, _react3.storiesOf)('molecules', module).addDecorator((0, _addonKnobs.withKnobs)({ escapeHTML: false })).add('Breadcrumb', function () {
  var currentItemProp = {
    currentPage: (0, _addonKnobs.text)('currentPage', 'Suffolk DA - Historical Spending')
  };
  return _react2.default.createElement(
    _index2.default,
    null,
    getItem('Appropriation Recommendation', 0),
    getItem('Independents', 1),
    getItem('District Attorneys', 2),
    _react2.default.createElement(_item2.default, currentItemProp)
  );
});