"use strict";

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

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

var _DragonKitContext = require("../../context/DragonKitContext");

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

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// import { BlogHero } from '../BlogHero';
var BlogKit = function BlogKit(_ref) {
  var features = _ref.features,
      title = _ref.title,
      category = _ref.category,
      url = _ref.url,
      children = _ref.children,
      theme = _ref.theme;

  var _useDragonKitValue = (0, _DragonKitContext.useDragonKitValue)(),
      setDragonKitValue = _useDragonKitValue[1];

  (0, _react.useEffect)(function () {
    setDragonKitValue({
      type: 'theme',
      theme: theme
    });
    setDragonKitValue({
      type: 'blogUrl',
      blogUrl: url
    });
  }, []);
  var BlogHero; // eslint-disable-next-line global-require

  if (features) BlogHero = require('../BlogHero').BlogHero;
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, features && /*#__PURE__*/_react.default.createElement(BlogHero, null, features), title && /*#__PURE__*/_react.default.createElement("div", {
    className: "blog-title clouds-dark"
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: "inner"
  }, !category && /*#__PURE__*/_react.default.createElement("h1", null, title), category && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_LinkTo.LinkTo, {
    type: "route",
    to: url
  }, title, " /"), /*#__PURE__*/_react.default.createElement("span", null, category)))), /*#__PURE__*/_react.default.createElement("div", {
    className: "blog"
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: "inner"
  }, children)));
};

BlogKit.displayName = 'Blog Kit';
var BlogKitDoc;

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

var BlogKitWrapper = BlogKitDoc || BlogKit;
exports.BlogKit = BlogKitWrapper;