"use strict";

exports.__esModule = true;
exports.ArticleFeatureCard = void 0;

var _react = _interopRequireDefault(require("react"));

var _moment = _interopRequireDefault(require("moment"));

var _classnames = _interopRequireDefault(require("classnames"));

var _stringHash = _interopRequireDefault(require("string-hash"));

var _LinkTo = require("../LinkTo");

var _utils = require("../../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// TODO: replace moment
var ArticleFeatureCard = function ArticleFeatureCard(_ref) {
  var category = _ref.category,
      publishDate = _ref.publishDate,
      title = _ref.title,
      url = _ref.url,
      image = _ref.image;
  var hash = image && (0, _stringHash.default)(image);
  var imageClasses = (0, _classnames.default)('img', "rbiHandler-" + hash);
  return _react.default.createElement("div", {
    className: "slide"
  }, _react.default.createElement("div", {
    className: "inner"
  }, _react.default.createElement(_LinkTo.LinkTo, {
    type: "route",
    url: url
  }, (0, _utils.BackgroundImage)(image, hash), _react.default.createElement("div", {
    className: imageClasses
  }), _react.default.createElement("div", {
    className: "content"
  }, _react.default.createElement("h2", {
    className: "title"
  }, _react.default.createElement("span", null, title)), _react.default.createElement("div", {
    className: "category"
  }, category), _react.default.createElement("time", {
    dateTime: publishDate
  }, (0, _moment.default)(publishDate).format('MMMM DD, YYYY'))))));
};

ArticleFeatureCard.displayName = 'ArticleFeatureCard';
var ArticleFeatureCardDoc;

if (process.env.NODE_ENV !== 'production') {
  // eslint-disable-next-line global-require
  ArticleFeatureCardDoc = require('./doc').doc(ArticleFeatureCard);
}

var ArticleFeatureCardWrapper = ArticleFeatureCardDoc || ArticleFeatureCard;
exports.ArticleFeatureCard = ArticleFeatureCardWrapper;