'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

require('./_commonjsHelpers-06173234.js');
var React = require('react');
var React__default = _interopDefault(React);
require('prop-types');
require('react-dom');
var index$1 = require('./index-be0c82be.js');
var index$2 = require('./index-da796b8c.js');
var entities = require('./entities-310b46ee.js');
var Media = _interopDefault(require('react-bootstrap/Media'));

var ThumbnailCard = function ThumbnailCard(_ref) {
  var size = _ref.size,
      mediaData = _ref.mediaData,
      client = _ref.client,
      defaultImage = _ref.defaultImage;

  var builder = index$1.imageUrlBuilder(client);

  var urlFor = function urlFor(source) {
    return builder.image(source).auto('format');
  };

  return React__default.createElement(
    'div',
    null,
    mediaData && mediaData.map(function (item, index) {
      return React__default.createElement(
        Media,
        { className: 'mb-3 thumbnail-card' },
        React__default.createElement(
          index$2.LazyLoad,
          { height: size },
          React__default.createElement('img', { width: size, height: size, className: 'mr-3', src: item.thumbnail ? urlFor(item.thumbnail).url() : defaultImage, alt: 'Generic placeholder' })
        ),
        React__default.createElement(
          Media.Body,
          null,
          React__default.createElement(
            'h5',
            null,
            item.title
          ),
          React__default.createElement(
            'p',
            null,
            entities.clean_html_1(item.summary)
          )
        )
      );
    })
  );
};

module.exports = ThumbnailCard;
