Skip to content

Commit

Permalink
fix(Steps):Steps 点状步骤条显示问题 #554 (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuilanxin committed Mar 3, 2022
1 parent ed0bdbb commit 90d47f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
22 changes: 12 additions & 10 deletions packages/react-steps/src/Step.tsx
@@ -1,5 +1,5 @@
import React, { CSSProperties } from 'react';
import Icon, { IconProps } from '@uiw/react-icon';
import Icon, { IconProps, IconsName } from '@uiw/react-icon';
import { IProps, HTMLDivProps } from '@uiw/utils';
import './style/index.less';

Expand Down Expand Up @@ -57,14 +57,16 @@ export default function Step(props: StepProps) {
} else if ((icon && typeof icon === 'string') || status === 'finish' || status === 'error') {
iconNode = (
<Icon
type={[
icon && typeof icon === 'string' ? `${icon}` : null,
!icon && status === 'finish' ? 'check' : null,
!icon && status === 'error' ? 'close' : null,
]
.filter(Boolean)
.join(' ')
.trim()}
type={
[
icon && typeof icon === 'string' ? `${icon}` : null,
!icon && status === 'finish' ? 'check' : null,
!icon && status === 'error' ? 'close' : null,
]
.filter(Boolean)
.join(' ')
.trim() as IconsName | null
}
/>
);
} else {
Expand All @@ -73,7 +75,7 @@ export default function Step(props: StepProps) {
return (
<div {...restProps} className={classString} style={stepItemStyle}>
<div className={`${prefixCls}-item-tail`} style={stepItemDotStyle}>
<i />
<i style={{ paddingRight: '100%' }} />
</div>
<div className={`${prefixCls}-item-head`}>
<div className={[`${prefixCls}-item-inner`, !!icon && 'is-icon'].filter(Boolean).join(' ').trim()}>
Expand Down
6 changes: 3 additions & 3 deletions packages/react-steps/src/Steps.tsx
Expand Up @@ -3,8 +3,8 @@ import { IProps, HTMLDivProps } from '@uiw/utils';
import Step, { StepProps } from './Step';

export interface StepsProps<T> extends IProps, HTMLDivProps {
status?: StepProps<T>['status'];
progressDot?: StepProps<T>['progressDot'];
status?: StepProps['status'];
progressDot?: StepProps['progressDot'];
direction?: 'horizontal' | 'vertical';
/**
* 指定当前步骤,从 `0` 开始记数。
Expand Down Expand Up @@ -71,7 +71,7 @@ function InternalSteps<T>(props: StepsProps<T>) {
childProps.className = `${prefixCls}-next-error`;
}
if (!child.props.status) {
if (index === current) {
if (index === current!) {
childProps.status = status;
} else if (index < (current as number)) {
childProps.status = 'finish';
Expand Down

0 comments on commit 90d47f2

Please sign in to comment.