"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = CategoryItem;
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
var _link = require("../routes/link");
var _constants = require("../../utils/constants");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * Internal dependencies
 */

function CategoryItem({
  count,
  icon,
  id,
  isActive,
  label,
  type
}) {
  const linkInfo = (0, _link.useLink)({
    categoryId: id !== _constants.TEMPLATE_PART_ALL_AREAS_CATEGORY && id !== _constants.PATTERN_DEFAULT_CATEGORY ? id : undefined,
    postType: type === _constants.TEMPLATE_PART_POST_TYPE ? _constants.TEMPLATE_PART_POST_TYPE : _constants.PATTERN_TYPES.user
  });
  if (!count) {
    return;
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationItem.default, {
    ...linkInfo,
    icon: icon,
    suffix: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
      children: count
    }),
    "aria-current": isActive ? 'true' : undefined,
    children: label
  });
}
//# sourceMappingURL=category-item.js.map