'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 _react4 = require('@storybook/addon-knobs/react');

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

var _index2 = _interopRequireDefault(_index);

var _Icon = require('../../base/Icon');

var _Icon2 = _interopRequireDefault(_Icon);

var _IconKnob = require('../../base/Icon/Icon.knob.options');

var _Link = require('../../molecules/Link');

var _Link2 = _interopRequireDefault(_Link);

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

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 */
(0, _react3.storiesOf)('organisms/EmergencyAlerts', module).addDecorator((0, _react4.withKnobs)({ escapeHTML: false })).add('EmergencyAlerts with Alerts', function () {
  var props = {
    id: (0, _react4.text)('id', 'GUID18378923w38789'),
    theme: (0, _react4.select)('theme', _extends({}, themeOptions), 'c-warning'),
    buttonAlert: (0, _react4.object)('buttonAlert', {
      hideText: 'Hide ',
      showText: 'Show ',
      text: 'Updates'
    }),
    emergencyHeader: (0, _react4.object)('emergencyHeader', {
      title: 'The State is experiencing severe weather due to the winter storm Paula.'
    }),
    alerts: (0, _react4.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 _react2.default.createElement(
          _Link2.default,
          { classes: linkClasses, href: 'https://www.mass.gov' },
          _react2.default.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 _react2.default.createElement(
          _Link2.default,
          { classes: linkClasses, href: 'https://www.mass.gov' },
          _react2.default.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 _react2.default.createElement(
          _Link2.default,
          { classes: linkClasses, href: 'https://www.mass.gov' },
          _react2.default.createElement(
            TextElement,
            null,
            'Read full alert'
          )
        );
      }
    }])
  };
  return _react2.default.createElement(_index2.default, props);
}).add('EmergencyAlerts without Alerts', function () {
  var iconName = (0, _react4.select)('Icon: name', _IconKnob.svgOptions, 'opennow');
  var titleText = (0, _react4.text)('title', 'Our new & improved Boston office is now open!');
  var props = {
    id: (0, _react4.text)('id', 'GUID18378923w38789'),
    theme: (0, _react4.select)('theme', _extends({}, themeOptions), 'c-primary-alt'),
    emergencyHeader: (0, _react4.object)('emergencyHeader', {
      prefix: 'Updates',
      icon: !iconName ? null : _react2.default.createElement(_Icon2.default, { name: iconName }),
      title: function title(_ref4) {
        var linkClasses = _ref4.linkClasses;
        return _react2.default.createElement(
          'a',
          { className: linkClasses, href: 'https://www.mass.gov' },
          titleText
        );
      }
    }),
    buttonClose: (0, _react4.boolean)('buttonClose', true)
  };
  return _react2.default.createElement(_index2.default, props);
});