1
1
import React , { CSSProperties } from 'react' ;
2
2
import Icon , { IconProps , IconsName } from '@uiw/react-icon' ;
3
3
import { IProps , HTMLDivProps } from '@uiw/utils' ;
4
+ import { Check } from '@uiw/icons/lib/Check' ;
5
+ import { Close } from '@uiw/icons/lib/Close' ;
6
+
4
7
// import './style/index.less';
5
8
import {
6
9
StepsItem ,
@@ -13,8 +16,8 @@ import {
13
16
StepsItemMainDescription ,
14
17
StepsItemHeadInnerDot ,
15
18
StepsItemHeadInnerIcon ,
19
+ StepsItemHeadInnerSvg ,
16
20
} from './style' ;
17
-
18
21
export interface StepProps extends IProps , Omit < HTMLDivProps , 'title' > {
19
22
nextError ?: boolean | undefined ;
20
23
title ?: React . ReactNode ;
@@ -24,7 +27,7 @@ export interface StepProps extends IProps, Omit<HTMLDivProps, 'title'> {
24
27
itemWidth ?: number ;
25
28
stepNumber ?: string ;
26
29
adjustMarginRight ?: number ;
27
- icon ?: IconProps [ 'type' ] ;
30
+ icon ?: React . ReactNode ;
28
31
direction ?: 'horizontal' | 'vertical' ;
29
32
}
30
33
@@ -73,23 +76,14 @@ export default function Step(props: StepProps) {
73
76
{ icon }
74
77
</ StepsItemHeadInnerIcon >
75
78
) ;
76
- } else if ( ( icon && typeof icon === 'string' ) || status === 'finish' || status === 'error' ) {
79
+ } else if ( status === 'finish' || status === 'error' ) {
80
+ iconNode = < StepsItemHeadInnerSvg as = { status === 'finish' ? Check : Close } /> ;
81
+ } else {
77
82
iconNode = (
78
- < Icon
79
- type = {
80
- [
81
- icon && typeof icon === 'string' ? `${ icon } ` : null ,
82
- ! icon && status === 'finish' ? 'check' : null ,
83
- ! icon && status === 'error' ? 'close' : null ,
84
- ]
85
- . filter ( Boolean )
86
- . join ( ' ' )
87
- . trim ( ) as IconsName | null
88
- }
89
- />
83
+ < StepsItemHeadInnerIcon params = { { status, icon : ! ! icon } } className = { `${ prefixCls } -icon` } >
84
+ { stepNumber }
85
+ </ StepsItemHeadInnerIcon >
90
86
) ;
91
- } else {
92
- iconNode = < span className = { `${ prefixCls } -icon` } > { stepNumber } </ span > ;
93
87
}
94
88
return (
95
89
< StepsItem
0 commit comments