'use strict';

require('./_commonjsHelpers-06173234.js');
require('./core.get-iterator-method-f3c44602.js');
require('./web.dom.iterable-e34bf324.js');
var React = require('react');
require('./moment-ca3bd9fb.js');
require('./slicedToArray-f6d4eaa8.js');
require('./index-b5eb3ff8.js');
var urlFor = require('./urlFor.js');
require('./iconBase-68959171.js');
var index_esm = require('./index.esm-f93506ac.js');

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

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

var HorizontalHero = function HorizontalHero(props) {
  var client = props.client;


  var topArticle = props.dataRecord[0];
  var subArticles = props.dataRecord.slice(1, props.dataRecord.length);
  var _props$heroTitle = props.heroTitle,
      heroTitle = _props$heroTitle === undefined ? '' : _props$heroTitle,
      _props$borderColor = props.borderColor,
      borderColor = _props$borderColor === undefined ? 'black' : _props$borderColor;


  var topArticleThumbnail = '';
  var topArticleAltText = topArticle.title;
  if (topArticle.thumbnail && topArticle.thumbnail.asset) {
    topArticleThumbnail = urlFor({ client: client, source: topArticle.thumbnail.asset, imageWidth: 350 });

    topArticleAltText = topArticle.thumbnail.asset.originalFileName;
  }
  if (props.thumbnail) {
    topArticleThumbnail = props.thumbnail;
  }

  return React__default['default'].createElement(
    'div',
    { className: 'horizontal-hero-container', style: { borderRight: '3px solid ' + borderColor, borderTop: '3px solid ' + borderColor } },
    React__default['default'].createElement(
      'div',
      { className: 'horizontal-hero-title' },
      React__default['default'].createElement(
        'h2',
        null,
        heroTitle
      ),
      React__default['default'].createElement('div', null)
    ),
    React__default['default'].createElement(
      'div',
      { className: 'horizontal-hero-inner' },
      React__default['default'].createElement(
        'a',
        { href: '/view/' + topArticle.url.current, className: 'horizontal-hero-img' },
        React__default['default'].createElement('img', { style: { objectFit: props.imageSize ? props.imageSize : 'cover' }, src: topArticleThumbnail, alt: topArticleAltText })
      ),
      React__default['default'].createElement(
        'div',
        { className: 'horizontal-articles-wrap' },
        React__default['default'].createElement(
          'a',
          { href: '/view/' + topArticle.url.current, className: 'horizontal-article' },
          React__default['default'].createElement(
            'p',
            null,
            topArticle.title
          )
        ),
        subArticles.map(function (article, index) {
          return React__default['default'].createElement(
            'a',
            { key: index, href: '/view/' + article.url.current, className: 'horizontal-article' },
            React__default['default'].createElement(
              'p',
              null,
              article.title
            )
          );
        })
      )
    ),
    props.linkTo && React__default['default'].createElement(
      'div',
      { className: 'horizontal-view-more' },
      React__default['default'].createElement(
        'a',
        { href: props.linkTo },
        props.linkTitle ? props.linkTitle : 'View More' + heroTitle,
        ' ',
        ' ',
        React__default['default'].createElement(
          'span',
          null,
          React__default['default'].createElement(index_esm.FaLongArrowAltRight, { color: 'var(--primary)' })
        )
      )
    ),
    React__default['default'].createElement(
      'style',
      { jsx: 'true' },
      '\n        .horizontal-hero-container {\n          margin-bottom: 3rem;\n          margin-top: 2rem;\n          position: relative;\n        }\n        .horizontal-hero-title {\n          position: absolute;\n          top: -25px;\n          background: white;\n          z-index: 2;\n          padding-right: 1rem;\n          font-weight: bold;\n        }\n        .horizontal-hero-inner {\n          display: flex;\n          flex-direction: row;\n          padding-top: 0.75rem;\n          margin-top: 0.75rem;\n        }\n\n        .horizontal-articles-wrap {\n          padding: 0 1rem;\n          flex-basis: 60%;\n        }\n\n        .horizontal-hero-img {\n         flex-basis: 40%;\n        }\n        .horizontal-hero-img img {\n          width: 100%;\n          height: 100%;\n       \n        }\n        .horizontal-article {\n          border-bottom: 1px solid #ccc;\n          display: block;\n          margin-bottom: 0.5rem;\n        }\n        .horizontal-article:hover {\n          background: #eee;\n        }\n        .horizontal-article p {\n          font-size: 1.1rem;\n          margin-bottom: 0.5rem;\n          font-weight: bold;\n          color: #252525;\n        }\n        .horizontal-view-more {\n          position: absolute;\n          right: 0;\n          margin-top: 0.25rem;\n          font-weight: bold;\n        }\n        .horizontal-view-more span {\n          display: inline-block;\n          color: rgb(81, 116, 153);\n          font-size: 1.2rem;\n        }\n        @media screen and (max-width: 1191px){\n         \n            .horizontal-article > p {\n              font-size: 1rem;\n            }\n          }\n         \n        @media screen and (max-width: 768px) {\n          .horizontal-hero-img {\n            display: none;\n          }\n          .horizontal-articles-wrap {\n            \n            flex-basis: 100%;\n          }\n        }\n        @media screen and (max-width: 495px) {\n          \n          .horizontal-article > p {\n            font-size: 1rem;\n          }\n        }\n      '
    )
  );
};

module.exports = HorizontalHero;
