import React from 'react';
import classNames from 'classnames';
import { prefix, ErrorTypeTheme, errorTypes } from "../types";
import "./index.less";
// 渲染单个错误统计项
var renderErrorItem = function renderErrorItem(errorType, count) {
  var IconComponent = errorType.icon;
  var theme = ErrorTypeTheme[errorType.type];
  return /*#__PURE__*/React.createElement("div", {
    key: errorType.type,
    className: classNames("".concat(prefix, "-error-tip-statistics-item ").concat(errorType.type)),
    style: {
      backgroundColor: theme.backgroundColor,
      boxShadow: "0px 0px 3px 0px ".concat(theme.shadowColor)
    }
  }, /*#__PURE__*/React.createElement(IconComponent, {
    style: {
      color: theme.iconColor,
      fontSize: 28
    }
  }), /*#__PURE__*/React.createElement("div", {
    className: "statistics-item-info"
  }, /*#__PURE__*/React.createElement("div", {
    className: "statistics-item-title"
  }, errorType.title()), /*#__PURE__*/React.createElement("div", {
    className: "statistics-item-count"
  }, count)));
};
var Statistics = function Statistics(props) {
  var _props$data = props.data,
    data = _props$data === void 0 ? {
      fatal: 0,
      critical: 0,
      normal: 0,
      info: 0
    } : _props$data;
  return /*#__PURE__*/React.createElement("div", {
    className: classNames("".concat(prefix, "-error-tip-statistics"))
  }, errorTypes.map(function (errorType) {
    return renderErrorItem(errorType, data[errorType.type]);
  }));
};
export default Statistics;