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, { Fragment } from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
import SidebarHeading from '../../atoms/headings/SidebarHeading';
import { ColorSwatch, GradientSpectrum } from './index';
import { themeColors, grayScaleColors, utilityColors, primaryColors, primaryAltColors, highLightColors } from './colors.json';

import ColorGradientsDocs from './ColorGradients.md';

import './styles.css';

storiesOf('brand|colors', module).addDecorator(withKnobs({ escapeHTML: false })).add('Colors', function () {
  return React.createElement(
    Fragment,
    null,
    React.createElement(SidebarHeading, { title: 'Mayflower Brand Colors', level: 2 }),
    React.createElement(
      'ul',
      { className: 'sg-colors' },

      // eslint-disable-next-line react/no-array-index-key
      themeColors.map(function (color, i) {
        return React.createElement(ColorSwatch, _extends({ key: 'themeColors' + i }, color, { variable: color.token }));
      })
    ),
    React.createElement(SidebarHeading, { title: 'Theme Colors Usage', level: 2 }),
    React.createElement(
      'ul',
      { className: 'sg-colors' },

      // eslint-disable-next-line react/no-array-index-key
      primaryColors.map(function (color, i) {
        return React.createElement(ColorSwatch, _extends({ key: 'primaryColors' + i }, color));
      })
    ),
    React.createElement(
      'ul',
      { className: 'sg-colors' },

      // eslint-disable-next-line react/no-array-index-key
      primaryAltColors.map(function (color, i) {
        return React.createElement(ColorSwatch, _extends({ key: 'primaryAltColors' + i }, color));
      })
    ),
    React.createElement(
      'ul',
      { className: 'sg-colors' },

      // eslint-disable-next-line react/no-array-index-key
      highLightColors.map(function (color, i) {
        return React.createElement(ColorSwatch, _extends({ key: 'highLightColors' + i }, color));
      })
    ),
    React.createElement(SidebarHeading, { title: 'Gray Scale Colors', level: 2 }),
    React.createElement(
      'ul',
      { className: 'sg-colors' },

      // eslint-disable-next-line react/no-array-index-key
      grayScaleColors.map(function (color, i) {
        return React.createElement(ColorSwatch, _extends({ key: 'grayScaleColors' + i }, color));
      })
    ),
    React.createElement(SidebarHeading, { title: 'Utility Colors', level: 2 }),
    React.createElement(
      'ul',
      { className: 'sg-colors' },

      // eslint-disable-next-line react/no-array-index-key
      utilityColors.map(function (color, i) {
        return React.createElement(ColorSwatch, _extends({ key: 'utilityColors' + i }, color));
      })
    )
  );
}).add('Gradients (Light)', function () {
  return React.createElement(
    Fragment,
    null,
    themeColors.map(function (_ref, i) {
      var token = _ref.token,
          name = _ref.name;

      var props = {
        token: token.match(/\$(.*)/)[1],
        name: name,
        effect: 'tint'
      };
      return (
        // eslint-disable-next-line react/no-array-index-key
        React.createElement(GradientSpectrum, _extends({}, props, { key: 'spectrum_' + token + i }))
      );
    })
  );
}, { info: ColorGradientsDocs }).add('Gradients (Dark)', function () {
  return React.createElement(
    Fragment,
    null,
    themeColors.map(function (_ref2, i) {
      var token = _ref2.token,
          name = _ref2.name;

      var props = {
        token: token.match(/\$(.*)/)[1],
        name: name,
        effect: 'shade'
      };
      return (
        // eslint-disable-next-line react/no-array-index-key
        React.createElement(GradientSpectrum, _extends({}, props, { key: 'spectrum_' + token + i }))
      );
    })
  );
}, { info: ColorGradientsDocs });