'use strict';

var _extends = require('./extends-7c86182f.js');
var React = require('react');
var ArticleCarousel = require('./ArticleCarousel.js');
var index_esm = require('./index.esm-d81454e7.js');
var BlockContent = require('./BlockContent-9ebd251f.js');
var getSerializers = require('./index-e8c2ed3b.js');
require('./_commonjsHelpers-06173234.js');
require('./core.get-iterator-method-5643aa10.js');
require('./_object-pie-083f2dd6.js');
require('./YoutubeGroup.js');
require('./slicedToArray-067dd3bc.js');
require('./web.dom.iterable-d98303e0.js');
require('./index-187c967e.js');
require('./index-eadd5035.js');
require('react-dom');
require('prop-types');
require('./smoothscroll-99df7f93.js');
require('./urlFor.js');
require('./index-d48b231c.js');
require('./main-f1c77adb.js');
require('./iconBase-be4097c0.js');
require('react-bootstrap');
require('./index-fc2f1ca2.js');
require('./events-1b438fe7.js');
require('next/router');
require('./util-93a37fd0.js');
require('./Beam.js');
require('./stringify-f7a37a8d.js');
require('./asyncToGenerator-77821af0.js');
require('./_library-dd23b178.js');
require('./_iter-detect-b1df62f0.js');
require('./Segment.js');
require('./urlForFile-29d3815a.js');
require('./typeof-567e31ff.js');
require('./_is-array-54228b29.js');
require('./brightcove-react-player-loader.es-a195642e.js');
require('react-bootstrap/Modal');
require('react-bootstrap/Button');
require('react-bootstrap/Form');
require('./GroupDeck.js');
require('./moment-aca40de1.js');
require('./SocialShare.js');
require('next/head');
require('react-share');
require('./_object-to-array-ce86cae7.js');
require('./toConsumableArray-d7797c2b.js');
require('react-bootstrap/Pagination');
require('./entities-df1aed86.js');
require('./AdSlot.js');
require('./debounce-d4a2369b.js');
require('./isSymbol-03abbdf0.js');
require('./toNumber-5e1fac58.js');
require('react-bootstrap/Row');
require('react-bootstrap/Col');
require('./inherits-de66ea16.js');
require('./_object-sap-d1978572.js');
require('./define-property-e8404b64.js');
require('react-bootstrap/Figure');
require('react-bootstrap/OverlayTrigger');
require('react-bootstrap/Tooltip');
require('react-bootstrap/Popover');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

function HorizontalArticleListing(_ref) {
  var _ref$data = _ref.data,
      data = _ref$data === undefined ? null : _ref$data,
      _ref$client = _ref.client,
      client = _ref$client === undefined ? null : _ref$client,
      _ref$color = _ref.color,
      color = _ref$color === undefined ? '#FFFFFF' : _ref$color;

  // Look at AJMC for query setup
  // Data format = Array of Objects based on Taxonomies with videos and latest videos
  // {
  // name: ...,
  // identifier: ...,
  // data: Array of latest articles with videos
  // }
  return React__default['default'].createElement(
    'div',
    null,
    data.length > 0 ? data.map(function (taxonomy, index) {
      return React__default['default'].createElement(
        React__default['default'].Fragment,
        null,
        React__default['default'].createElement(
          'div',
          { key: 'articleCarousel_' + taxonomy.identifier + '_' + index, className: 'mb-3 horizontal-article' },
          React__default['default'].createElement(
            'div',
            { className: 'horizontal-article-header', style: { borderBottom: '2px solid ' + color } },
            React__default['default'].createElement(
              'div',
              { className: 'horizontal-article-title-wrapper' },
              React__default['default'].createElement(
                'a',
                { href: '/' + taxonomy.identifier },
                React__default['default'].createElement(
                  'h4',
                  { className: 'article-title-banner', style: { fontWeight: 'bold', color: 'var(--primary)', padding: '.25rem 0', margin: '0' } },
                  taxonomy.name
                )
              ),
              taxonomy.identifier && React__default['default'].createElement(
                'div',
                { style: { width: 'fit-content', whiteSpace: 'nowrap' } },
                React__default['default'].createElement(
                  'a',
                  { href: '/' + taxonomy.identifier },
                  'View All ',
                  React__default['default'].createElement(index_esm.IoIosArrowForward, null)
                )
              )
            ),
            taxonomy.summary && React__default['default'].createElement(
              'div',
              { className: 'horizontal-article-summary' },
              React__default['default'].createElement(BlockContent.BlockContent, _extends._extends({ serializers: getSerializers.getSerializers(client), blocks: taxonomy.summary, imageOptions: { w: 320, h: 240, fit: 'max' } }, client.config()))
            )
          ),
          taxonomy.data.length > 0 ? React__default['default'].createElement(
            'div',
            { className: 'article-carousel' },
            React__default['default'].createElement(ArticleCarousel, { articles: taxonomy.data, client: client })
          ) : React__default['default'].createElement(
            'div',
            null,
            React__default['default'].createElement(
              'h5',
              { className: 'mt-2' },
              React__default['default'].createElement(
                'em',
                { className: 'pl-3' },
                'New content coming soon, please check back later.'
              )
            )
          )
        ),
        React__default['default'].createElement(
          'style',
          { jsx: 'true' },
          '\n                .article-carousel {\n                  display: flex;\n                  align-items: center;\n                  justify-content: center;\n                }\n                .horizontal-article-title-wrapper {\n                  display: flex;\n                  flex-wrap: no-wrap;\n                  align-items: center;\n                  justify-content: space-between;\n                }\n              '
        )
      );
    }) : React__default['default'].createElement(
      'div',
      null,
      React__default['default'].createElement(
        'h5',
        null,
        React__default['default'].createElement(
          'em',
          { className: 'pl-3' },
          'New content coming soon, please check back later.'
        )
      )
    )
  );
}

module.exports = HorizontalArticleListing;
