Skip to content

Commit

Permalink
Fix items (#272)
Browse files Browse the repository at this point in the history
* feat: fix items

* feat: fix items

* feat: fix items

* feat: fix items status

* merge master

* fix items

* fix items
  • Loading branch information
heiyu4585 authored Nov 1, 2022
1 parent 1831af2 commit 13a3c08
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
16 changes: 9 additions & 7 deletions src/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,19 @@ export default class Steps extends React.Component<StepsProps> {
mergedItem.className = `${prefixCls}-next-error`;
}

if (stepNumber === current) {
mergedItem.status = status;
} else if (stepNumber < current) {
mergedItem.status = 'finish';
} else {
mergedItem.status = 'wait';
if (!mergedItem.status) {
if (stepNumber === current) {
mergedItem.status = status;
} else if (stepNumber < current) {
mergedItem.status = 'finish';
} else {
mergedItem.status = 'wait';
}
}

return (
<Step
{...mergedItem}
active={stepNumber === current}
stepNumber={stepNumber + 1}
stepIndex={stepNumber}
Expand All @@ -129,7 +132,6 @@ export default class Steps extends React.Component<StepsProps> {
stepIcon={stepIcon}
icons={icons}
onStepClick={onChange && this.onStepClick}
{...mergedItem}
/>
);
})}
Expand Down
24 changes: 10 additions & 14 deletions tests/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ exports[`Steps render renders step with description and status 1`] = `
class="rc-steps rc-steps-horizontal rc-steps-label-horizontal"
>
<div
class="rc-steps-item rc-steps-item-process rc-steps-item-active"
class="rc-steps-item rc-steps-item-wait rc-steps-item-active"
>
<div
class="rc-steps-item-container"
Expand Down Expand Up @@ -960,7 +960,7 @@ exports[`Steps render renders step with description and status 1`] = `
</div>
</div>
<div
class="rc-steps-item rc-steps-item-wait"
class="rc-steps-item rc-steps-item-process"
>
<div
class="rc-steps-item-container"
Expand Down Expand Up @@ -994,7 +994,7 @@ exports[`Steps render renders step with description and status 1`] = `
</div>
</div>
<div
class="rc-steps-item rc-steps-item-wait"
class="rc-steps-item rc-steps-item-finish"
>
<div
class="rc-steps-item-container"
Expand All @@ -1006,10 +1006,8 @@ exports[`Steps render renders step with description and status 1`] = `
class="rc-steps-item-icon"
>
<span
class="rc-steps-icon"
>
4
</span>
class="rc-steps-icon rcicon rcicon-check"
/>
</div>
<div
class="rc-steps-item-content"
Expand Down Expand Up @@ -1543,7 +1541,7 @@ exports[`Steps render renders with falsy children 1`] = `
class="rc-steps rc-steps-horizontal rc-steps-label-horizontal"
>
<div
class="rc-steps-item rc-steps-item-process rc-steps-item-active"
class="rc-steps-item rc-steps-item-wait rc-steps-item-active"
>
<div
class="rc-steps-item-container"
Expand Down Expand Up @@ -1617,7 +1615,7 @@ exports[`Steps render renders with falsy children 1`] = `
</div>
</div>
<div
class="rc-steps-item rc-steps-item-wait"
class="rc-steps-item rc-steps-item-process"
>
<div
class="rc-steps-item-container"
Expand Down Expand Up @@ -1651,7 +1649,7 @@ exports[`Steps render renders with falsy children 1`] = `
</div>
</div>
<div
class="rc-steps-item rc-steps-item-wait rc-steps-item-disabled"
class="rc-steps-item rc-steps-item-finish rc-steps-item-disabled"
>
<div
class="rc-steps-item-container"
Expand All @@ -1663,10 +1661,8 @@ exports[`Steps render renders with falsy children 1`] = `
class="rc-steps-item-icon"
>
<span
class="rc-steps-icon"
>
4
</span>
class="rc-steps-icon rcicon rcicon-check"
/>
</div>
<div
class="rc-steps-item-content"
Expand Down

0 comments on commit 13a3c08

Please sign in to comment.