1 | import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2 | import classNames from 'classnames';
|
3 | import * as React from 'react';
|
4 | var Steps = function Steps(props) {
|
5 | var size = props.size,
|
6 | steps = props.steps,
|
7 | _props$percent = props.percent,
|
8 | percent = _props$percent === void 0 ? 0 : _props$percent,
|
9 | _props$strokeWidth = props.strokeWidth,
|
10 | strokeWidth = _props$strokeWidth === void 0 ? 8 : _props$strokeWidth,
|
11 | strokeColor = props.strokeColor,
|
12 | _props$trailColor = props.trailColor,
|
13 | trailColor = _props$trailColor === void 0 ? null : _props$trailColor,
|
14 | prefixCls = props.prefixCls,
|
15 | children = props.children;
|
16 | var current = Math.round(steps * (percent / 100));
|
17 | var stepWidth = size === 'small' ? 2 : 14;
|
18 | var styledSteps = new Array(steps);
|
19 | for (var i = 0; i < steps; i++) {
|
20 | var color = Array.isArray(strokeColor) ? strokeColor[i] : strokeColor;
|
21 | styledSteps[i] = React.createElement("div", {
|
22 | key: i,
|
23 | className: classNames(prefixCls + "-steps-item", _defineProperty({}, prefixCls + "-steps-item-active", i <= current - 1)),
|
24 | style: {
|
25 | backgroundColor: i <= current - 1 ? color : trailColor,
|
26 | width: stepWidth,
|
27 | height: strokeWidth
|
28 | }
|
29 | });
|
30 | }
|
31 | return React.createElement("div", {
|
32 | className: prefixCls + "-steps-outer"
|
33 | }, styledSteps, children);
|
34 | };
|
35 | export default Steps; |
\ | No newline at end of file |