'use strict';

var _typeof = require('./typeof-567e31ff.js');
var React = require('react');
var index = require('./index-eadd5035.js');
var urlFor = require('./urlFor.js');
var moment = require('./moment-aca40de1.js');
var styleInject_es = require('./style-inject.es-dcee06b6.js');
require('prop-types');
require('./_commonjsHelpers-06173234.js');
require('./core.get-iterator-method-5643aa10.js');
require('./web.dom.iterable-d98303e0.js');
require('./_is-array-54228b29.js');
require('./_object-pie-083f2dd6.js');
require('./_library-dd23b178.js');
require('react-dom');
require('./slicedToArray-067dd3bc.js');
require('./index-d48b231c.js');

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

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

var css = ".VideoSeriesCard-module_article__Hlc3e {\n  width: 100%;\n  margin: 0 0 1rem 0;\n}\n.VideoSeriesCard-module_article__Hlc3e a {\n  display: flex;\n  width: 100%;\n  color: #000000;\n}\n.VideoSeriesCard-module_thumb__3hGyJ {\n  width: 25%;\n}\n.VideoSeriesCard-module_thumb__3hGyJ img {\n  width: 100%;\n  height: auto;\n}\n.VideoSeriesCard-module_info__2_i1N {\n  width: 75%;\n  font-size: 1rem;\n}\n.VideoSeriesCard-module_info__2_i1N h2 {\n  font-weight: bold;\n  font-size: 1.25rem;\n  margin: 0;\n}\n.VideoSeriesCard-module_published__1fI0q {\n  color: #6d6d6d;\n  margin: 0;\n}\n.VideoSeriesCard-module_summary__3hWJT {\n  margin: 0.5rem 0 0 0;\n}\n.VideoSeriesCard-module_author__aU35o {\n  margin: 0;\n}\n.VideoSeriesCard-module_author__aU35o span {\n  color: #6d6d6d;\n}\n@media only screen and (max-width: 568px) {\n  .VideoSeriesCard-module_article__Hlc3e {\n    margin: 1rem 0;\n    box-shadow: 2px 4px 8px rgba(0,0,0,.2);\n  }\n  .VideoSeriesCard-module_article__Hlc3e a {\n    flex-direction: column;\n    align-items: center;\n  }\n  .VideoSeriesCard-module_thumb__3hGyJ {\n    overflow: hidden;\n    width: 100%;\n    margin-bottom: 1rem;\n  }\n  .VideoSeriesCard-module_thumb__3hGyJ img{\n    border-radius: 10px 10px 0 0;    \n  }\n  .VideoSeriesCard-module_thumb__3hGyJ figure {\n    margin: 0;\n  }\n  .VideoSeriesCard-module_info__2_i1N {\n    width: 90%;\n    padding: 1rem !important;\n  }\n  .VideoSeriesCard-module_info__2_i1N h2 {\n    font-size: 1rem;\n  }\n}\n";
var styles = { "article": "VideoSeriesCard-module_article__Hlc3e", "thumb": "VideoSeriesCard-module_thumb__3hGyJ", "info": "VideoSeriesCard-module_info__2_i1N", "published": "VideoSeriesCard-module_published__1fI0q", "summary": "VideoSeriesCard-module_summary__3hWJT", "author": "VideoSeriesCard-module_author__aU35o" };
styleInject_es.styleInject(css);

var VideoSeriesCard = function VideoSeriesCard(props) {
  var data = props.data,
      variant = props.variant,
      defaultImage = props.defaultImage,
      client = props.client,
      index$1 = props.index;

  var episode = parseInt(index$1) + 1;

  return React__default['default'].createElement(
    'div',
    { className: styles.article },
    React__default['default'].createElement(
      'a',
      { href: '/view/' + data.url.current, style: variant === 'right' ? { flexDirection: 'row-reverse' } : {} },
      React__default['default'].createElement(
        'div',
        { className: styles.thumb },
        React__default['default'].createElement(
          'figure',
          null,
          React__default['default'].createElement(
            index.LazyLoad,
            null,
            React__default['default'].createElement('img', {
              src: data.thumbnail && data.thumbnail.asset ? urlFor({ client: client, source: data.thumbnail }) : data.thumbnail && _typeof._typeof(data.thumbnail == 'string') ? data.thumbnail : defaultImage
            })
          )
        )
      ),
      React__default['default'].createElement(
        'div',
        { className: styles.info, style: variant === 'right' ? { padding: '0 1rem 0 0' } : { padding: ' 0 0 0 1rem' } },
        React__default['default'].createElement(
          'div',
          { style: { fontSize: '1.3rem', fontWeight: 'bold' } },
          episode && 'EP ' + episode + ': ',
          data.title
        ),
        data.published && React__default['default'].createElement(
          'p',
          { className: styles.published },
          moment.moment(data.published).format('MMMM Do YYYY')
        ),
        data.authorMapping && data.authorMapping.displayName && React__default['default'].createElement(
          'p',
          { className: styles.author },
          'By ',
          React__default['default'].createElement(
            'span',
            null,
            data.authorMapping.displayName
          )
        ),
        data.intro && React__default['default'].createElement('p', { dangerouslySetInnerHTML: { __html: data.intro }, className: styles.summary })
      )
    )
  );
};

module.exports = VideoSeriesCard;
