'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

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

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

var _ = require('../../..');

var _2 = _interopRequireDefault(_);

var _TeaserListing = require('./TeaserListing.md');

var _TeaserListing2 = _interopRequireDefault(_TeaserListing);

var _TeaserListingKnob = require('./TeaserListing.knob.options');

var _TeaserListingKnob2 = _interopRequireDefault(_TeaserListingKnob);

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

(0, _react3.storiesOf)('organisms', module).addDecorator((0, _addonKnobs.withKnobs)({ escapeHTML: false })).add('TeaserListing', function () {
  var featuredOptions = _TeaserListingKnob2.default.teaserListing.featuredItems.map(function (item, index) {
    var newItem = Object.assign({}, item);
    var title = (0, _addonKnobs.object)('TeaserListing featuredItem' + index + ': title', _extends({}, newItem.title), 'Featured Item ' + index);
    var description = (0, _addonKnobs.object)('TeaserListing featuredItem' + index + ': description', _extends({}, newItem.description), 'Featured Item ' + index);
    return {
      image: item.image,
      eyebrow: item.eyebrow,
      org: item.org,
      date: item.date,
      title: _react2.default.createElement(_index.DecorativeLink, title),
      description: _react2.default.createElement(_index.Paragraph, description)

    };
  });
  var itemsOptions = _TeaserListingKnob2.default.teaserListing.items.map(function (item, index) {
    var newItem = Object.assign({}, item);
    var title = (0, _addonKnobs.object)('TeaserListing item' + index + ': title', _extends({}, newItem.title), 'Item ' + index);
    var description = (0, _addonKnobs.object)('TeaserListing item' + index + ': description', _extends({}, newItem.description), 'Item ' + index);
    return {
      title: _react2.default.createElement(_index.DecorativeLink, title),
      description: _react2.default.createElement(_index.Paragraph, description)
    };
  });
  var props = {
    compHeading: (0, _addonKnobs.object)('TeaserListing compHeading', _TeaserListingKnob2.default.teaserListing.compHeading, 'CompHeading'),
    sidebarHeading: (0, _addonKnobs.object)('TeaserListing sidebarHeading', _TeaserListingKnob2.default.teaserListing.sidebarHeading, 'SidebarHeading'),
    description: {
      text: (0, _addonKnobs.text)('TeaserListing description: text', _TeaserListingKnob2.default.teaserListing.description.text)
    },
    stacked: (0, _addonKnobs.boolean)('TeaserListing stacked', false),
    contained: (0, _addonKnobs.boolean)('TeaserListing contained', true),
    gridTwoColumns: (0, _addonKnobs.boolean)('TeaserListing gridTwoColumns', true),
    shownItems: (0, _addonKnobs.number)('TeaserListing shownItems', 4),
    moreLabel: (0, _addonKnobs.text)('TeaserListing moreLabel', 'More'),
    lessLabel: (0, _addonKnobs.text)('TeaserListing lessLabel', 'Less'),
    featuredItems: featuredOptions,
    items: itemsOptions,
    more: (0, _addonKnobs.object)('TeaserListing more', _TeaserListingKnob2.default.teaserListing.more)
  };
  return _react2.default.createElement(_2.default, props);
}, { info: _TeaserListing2.default });