"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _breadcrumb = _interopRequireDefault(require("@alifd/next/lib/breadcrumb"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireDefault(require("react"));
require("./index.scss");
var _excluded = ["dataList", "itemList"];
var BreadCrumb = function BreadCrumb(_ref) {
  var dataList = _ref.dataList,
    itemList = _ref.itemList,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  var _otherProps = otherProps || {};
  var renderItems = function renderItems() {
    if ((dataList === null || dataList === void 0 ? void 0 : dataList.length) > 0) {
      return dataList.map(function (item, index) {
        return /*#__PURE__*/_react["default"].createElement(_breadcrumb["default"].Item, {
          key: index,
          link: item.link
        }, item.name);
      });
    }
    if ((itemList === null || itemList === void 0 ? void 0 : itemList.length) > 0) {
      return itemList.map(function (item, index) {
        return /*#__PURE__*/_react["default"].createElement(_breadcrumb["default"].Item, {
          key: index,
          link: item.link
        }, item.name);
      });
    }
    return /*#__PURE__*/_react["default"].createElement(_breadcrumb["default"].Item, null, "\u6682\u65E0\u6570\u636E");
  };
  return /*#__PURE__*/_react["default"].createElement(_breadcrumb["default"], _otherProps, renderItems());
};
BreadCrumb.displayName = 'BreadCrumb';
var _default = exports["default"] = BreadCrumb;