import React from 'react';
import { Card } from 'react-bootstrap';
import { i as imageUrlBuilder } from './index-0dbff1d1.js';
import { c as clean_html_1 } from './entities-932b50cf.js';
import './_commonjsHelpers-0c4b6f40.js';

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

var renderCardImage = function renderCardImage(thumbnail, client, imageHeight, imageWidth) {
  var url = urlFor(thumbnail, client);
  if (imageHeight) url = url.height(imageHeight);
  if (imageWidth) url = url.width(imageWidth);
  return url.url();
};

var Hero = function Hero(_ref) {
  var data = _ref.data,
      client = _ref.client,
      imageHeight = _ref.imageHeight,
      imageWidth = _ref.imageWidth;
  var title = data.title,
      summary = data.summary,
      thumbnail = data.thumbnail,
      url = data.url;

  return React.createElement(
    'a',
    { href: '/view/' + url.current },
    React.createElement(
      Card,
      { bsPrefix: 'hero-card' },
      title && React.createElement(
        Card.Header,
        { className: 'h4' },
        title
      ),
      thumbnail && client && React.createElement(Card.Img, { src: renderCardImage(thumbnail, client, imageHeight, imageWidth) }),
      summary && React.createElement(
        Card.Footer,
        { className: 'h6' },
        clean_html_1(summary)
      )
    )
  );
};

export default Hero;
