"use strict";

exports.__esModule = true;
exports.default = void 0;
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _button = _interopRequireDefault(require("../../atom/button"));
var _cardContent = _interopRequireWildcard(require("../card-content"));
var _types = require("./types");
var _style = _interopRequireDefault(require("./style.css"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const Hero = (props, context) => {
  const {
    skin
  } = context;
  const {
    image,
    title,
    author,
    progress,
    onClick,
    submitValue,
    description,
    mode = _cardContent.MODES.HERO
  } = props;
  const primaryColor = (0, _get2.default)('common.primary', skin);
  const cardStyle = (0, _classnames.default)(_style.default.hero, title ? _style.default.defaultStyle : _style.default.lazy);
  return /*#__PURE__*/_react.default.createElement("div", {
    className: cardStyle,
    "data-name": "hero"
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.imageWrapper
  }, /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "cover",
    className: _style.default.image,
    style: {
      backgroundColor: primaryColor,
      backgroundImage: image ? `url('${image}')` : 'none'
    }
  })), mode === _cardContent.MODES.HERO ? /*#__PURE__*/_react.default.createElement(_cardContent.default, {
    mode: _cardContent.MODES.HERO,
    author: author,
    progress: progress,
    title: title
  }) : /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.infoWrapper
  }, /*#__PURE__*/_react.default.createElement("h1", {
    className: _style.default.title
  }, title), /*#__PURE__*/_react.default.createElement("p", {
    className: _style.default.description
  }, description)), mode === _cardContent.MODES.HERO ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.heroButtonWrapper
  }, /*#__PURE__*/_react.default.createElement(_button.default, {
    type: "link",
    "data-name": "hero-button",
    onClick: onClick,
    submitValue: submitValue,
    className: _style.default.heroButton,
    style: {
      backgroundColor: primaryColor
    }
  })) : null);
};
Hero.contextTypes = {
  skin: _provider.default.childContextTypes.skin
};
Hero.propTypes = process.env.NODE_ENV !== "production" ? _types.propTypes : {};
var _default = exports.default = Hero;
//# sourceMappingURL=index.js.map