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; };

import React from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs, text, object, boolean, number } from '@storybook/addon-knobs';

import { DecorativeLink, Paragraph } from '../../../index';
import TeaserListing from '../../..';
import TeaserListingDocs from './TeaserListing.md';
import TeaserListingData from './TeaserListing.knob.options';

storiesOf('organisms', module).addDecorator(withKnobs({ escapeHTML: false })).add('TeaserListing', function () {
  var featuredOptions = TeaserListingData.teaserListing.featuredItems.map(function (item, index) {
    var newItem = Object.assign({}, item);
    var title = object('TeaserListing featuredItem' + index + ': title', _extends({}, newItem.title), 'Featured Item ' + index);
    var description = 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: React.createElement(DecorativeLink, title),
      description: React.createElement(Paragraph, description)

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