"use strict";

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

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

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

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

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

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 = (0, _DragonKitContext.useDragonKitValue)(),
      dragonKit = _useDragonKitValue[0];

  if (!dragonKit.blogUrl) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
    className: "title"
  }, title), /*#__PURE__*/_react.default.createElement("nav", {
    className: isArticle ? '' : 'blog-categories'
  }, /*#__PURE__*/_react.default.createElement("ul", null, categories.map(function (category) {
    return /*#__PURE__*/_react.default.createElement("li", {
      key: category
    }, /*#__PURE__*/_react.default.createElement(_LinkTo.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;
exports.Categories = CategoriesWrapper;