'use strict';

var React = require('react');
var Media = require('react-bootstrap/Media');
var index = require('./index-efca863c.js');
var index$1 = require('./index-eadd5035.js');
var entities = require('./entities-3f9d0f2f.js');
require('./_commonjsHelpers-06173234.js');
require('react-dom');
require('prop-types');

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

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

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

  var builder = index.imageUrlBuilder(client);

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

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

module.exports = ThumbnailCard;
