'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');
var BlockContent = require('./BlockContent-9ebd251f.js');
var getSerializers = require('./index-144b90c4.js');

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

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

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

var MediaSeriesCard = function MediaSeriesCard(props) {
  var data = props.data,
      variant = props.variant,
      defaultImage = props.defaultImage,
      client = props.client;


  return React__default['default'].createElement(
    'div',
    { className: 'media-series-article ' + styles.article },
    React__default['default'].createElement(
      'a',
      { href: '/' + data.parentUrl + '/' + data.identifier.current, style: variant === 'right' ? { flexDirection: 'row-reverse' } : {} },
      React__default['default'].createElement(
        'div',
        { className: 'media-series-thumbnail ' + styles.thumb },
        data.thumbnail && data.thumbnail.asset && 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: 'media-series-info ' + styles.info, style: variant === 'right' ? { padding: '0 1rem 0 0' } : { padding: ' 0 0 0 1rem' } },
        React__default['default'].createElement(
          'div',
          { className: 'media-series-name ' + styles.name },
          data.name
        ),
        data.published && React__default['default'].createElement(
          'p',
          { className: 'media-series-published ' + styles.published },
          moment.moment(data.published).format('MMMM Do YYYY')
        ),
        data.authorMapping && data.authorMapping.displayName && React__default['default'].createElement(
          'p',
          { className: 'media-series-author ' + styles.author },
          'By ',
          React__default['default'].createElement(
            'span',
            null,
            data.authorMapping.displayName
          )
        ),
        data.description && React__default['default'].createElement(
          'div',
          { className: 'media-series-desc' },
          React__default['default'].createElement(BlockContent.BlockContent, { blocks: data.description, serializers: getSerializers.getSerializers(client) })
        )
      )
    )
  );
};

exports.MediaSeriesCard = MediaSeriesCard;
