import React, { useEffect } from 'react';
import { useDragonKitValue } from '../../context/DragonKitContext';
import { LinkTo } from '../LinkTo'; // 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 = useDragonKitValue(),
      setDragonKitValue = _useDragonKitValue[1];

  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.createElement(React.Fragment, null, features && /*#__PURE__*/React.createElement(BlogHero, null, features), title && /*#__PURE__*/React.createElement("div", {
    className: "blog-title clouds-dark"
  }, /*#__PURE__*/React.createElement("div", {
    className: "inner"
  }, !category && /*#__PURE__*/React.createElement("h1", null, title), category && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinkTo, {
    type: "route",
    to: url
  }, title, " /"), /*#__PURE__*/React.createElement("span", null, category)))), /*#__PURE__*/React.createElement("div", {
    className: "blog"
  }, /*#__PURE__*/React.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;
export { BlogKitWrapper as BlogKit };