import React from 'react';
import { LinkTo } from '../LinkTo';
import { useDragonKitValue } from '../../context/DragonKitContext';

var Categories = function Categories(_ref) {
  var categories = _ref.categories,
      _ref$isArticle = _ref.isArticle,
      isArticle = _ref$isArticle === void 0 ? false : _ref$isArticle,
      title = _ref.title;

  var _useDragonKitValue = useDragonKitValue(),
      dragonKit = _useDragonKitValue[0];

  if (!dragonKit.blogUrl) return /*#__PURE__*/React.createElement(React.Fragment, null);
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
    className: "title"
  }, title), /*#__PURE__*/React.createElement("nav", {
    className: isArticle ? '' : 'blog-categories'
  }, /*#__PURE__*/React.createElement("ul", null, categories.map(function (category) {
    return /*#__PURE__*/React.createElement("li", {
      key: category
    }, /*#__PURE__*/React.createElement(LinkTo, {
      type: "route",
      url: dragonKit.blogUrl + "/categories/" + category.replace(/\s+/g, '-').toLowerCase()
    }, category));
  }))));
};

Categories.displayName = 'Block Label';
var CategoriesDoc;

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

var CategoriesWrapper = CategoriesDoc || Categories;
export { CategoriesWrapper as Categories };