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, select, object, boolean } from '@storybook/addon-knobs/react';

import EmergencyAlerts from './index';
import Icon from '../../base/Icon';
import { svgOptions } from '../../base/Icon/Icon.knob.options';
import Link from '../../molecules/Link';

var themeOptions = {
  'c-warning (default)': 'c-warning',
  'c-primary': 'c-primary',
  'c-primary-alt': 'c-primary-alt',
  'c-gray': 'c-gray',
  'c-error': 'c-error'
};

/* eslint-disable  react/prop-types */
storiesOf('organisms/EmergencyAlerts', module).addDecorator(withKnobs({ escapeHTML: false })).add('EmergencyAlerts with Alerts', function () {
  var props = {
    id: text('id', 'GUID18378923w38789'),
    theme: select('theme', _extends({}, themeOptions), 'c-warning'),
    buttonAlert: object('buttonAlert', {
      hideText: 'Hide ',
      showText: 'Show ',
      text: 'Updates'
    }),
    emergencyHeader: object('emergencyHeader', {
      title: 'The State is experiencing severe weather due to the winter storm Paula.'
    }),
    alerts: object('alerts', [{
      message: 'MassPort is operating with limited flights due to road closures.',
      timeStamp: '02.15.16, 5:00 p.m.',
      link: function link(_ref) {
        var linkClasses = _ref.linkClasses,
            TextElement = _ref.TextElement;
        return React.createElement(
          Link,
          { classes: linkClasses, href: 'https://www.mass.gov' },
          React.createElement(
            TextElement,
            null,
            'Read full alert'
          )
        );
      }
    }, {
      message: 'The MTBA is operating at a lighter service level, and experiencing delays.',
      timeStamp: '02.15.16, 3:00 p.m.',
      link: function link(_ref2) {
        var linkClasses = _ref2.linkClasses,
            TextElement = _ref2.TextElement;
        return React.createElement(
          Link,
          { classes: linkClasses, href: 'https://www.mass.gov' },
          React.createElement(
            TextElement,
            null,
            'Read full alert'
          )
        );
      }
    }, {
      message: 'The Governor directs non-emergency executive branch state employees to not come in to work.',
      timeStamp: '02.13.16, 10:00 a.m.',
      link: function link(_ref3) {
        var linkClasses = _ref3.linkClasses,
            TextElement = _ref3.TextElement;
        return React.createElement(
          Link,
          { classes: linkClasses, href: 'https://www.mass.gov' },
          React.createElement(
            TextElement,
            null,
            'Read full alert'
          )
        );
      }
    }])
  };
  return React.createElement(EmergencyAlerts, props);
}).add('EmergencyAlerts without Alerts', function () {
  var iconName = select('Icon: name', svgOptions, 'opennow');
  var titleText = text('title', 'Our new & improved Boston office is now open!');
  var props = {
    id: text('id', 'GUID18378923w38789'),
    theme: select('theme', _extends({}, themeOptions), 'c-primary-alt'),
    emergencyHeader: object('emergencyHeader', {
      prefix: 'Updates',
      icon: !iconName ? null : React.createElement(Icon, { name: iconName }),
      title: function title(_ref4) {
        var linkClasses = _ref4.linkClasses;
        return React.createElement(
          'a',
          { className: linkClasses, href: 'https://www.mass.gov' },
          titleText
        );
      }
    }),
    buttonClose: boolean('buttonClose', true)
  };
  return React.createElement(EmergencyAlerts, props);
});