choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
61 lines (50 loc) • 2.04 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import isString from 'lodash/isString';
import classNames from 'classnames';
var RenderIcon = function RenderIcon(props) {
var prefixCls = props.prefixCls,
progressDot = props.progressDot,
stepNumber = props.stepNumber,
status = props.status;
if (progressDot) {
var iconDot = /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-icon-dot")
});
if (typeof progressDot === 'function') {
var title = props.title,
description = props.description;
return /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, progressDot(iconDot, {
index: stepNumber - 1,
status: status,
title: title,
description: description
}));
}
return /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, iconDot);
}
var icon = props.icon;
if (icon && !isString(icon)) {
return /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, icon);
}
if (icon || status === 'finish' || status === 'error') {
var _classNames;
var iconPrefix = props.iconPrefix;
var iconClassName = classNames("".concat(prefixCls, "-icon"), "".concat(iconPrefix), (_classNames = {}, _defineProperty(_classNames, "".concat(iconPrefix, "-").concat(icon), icon && isString(icon)), _defineProperty(_classNames, "".concat(iconPrefix, "-check"), !icon && status === 'finish'), _defineProperty(_classNames, "".concat(iconPrefix, "-close"), !icon && status === 'error'), _classNames));
return /*#__PURE__*/React.createElement("span", {
className: iconClassName
});
}
return /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-icon")
}, stepNumber);
};
RenderIcon.displayName = 'RcRenderIcon';
export default RenderIcon;
//# sourceMappingURL=RenderIcon.js.map