Skip to content

Commit 585fbf6

Browse files
committed
feat: UX for stepper changed
1 parent 7708ded commit 585fbf6

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

packages/react-sdk-components/src/components/infra/MultiStep/MultiStep.css

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,26 @@ mat-horizontal-stepper {
185185
}
186186

187187
.psdk-horizontal-step-icon {
188-
background-color: var(--stepper-completed-bg-color);
189188
color: white;
190189
border-radius: 50%;
191190
height: 24px;
192191
width: 24px;
193192
position: relative;
194193
}
195194

196-
.psdk-horizontal-step-icon-future {
195+
.future .psdk-horizontal-step-icon {
197196
color: var(--app-neutral-color);
198197
border: 1px solid var(--app-neutral-color);
199-
border-radius: 50%;
200-
height: 24px;
201-
width: 24px;
202-
position: relative;
198+
}
199+
200+
.current .psdk-horizontal-step-icon {
201+
color: var(--app-text-color);
202+
background-color: var(--app-primary-color);
203+
}
204+
205+
.success .psdk-horizontal-step-icon {
206+
color: var(--app-text-color);
207+
background-color: var(--stepper-completed-bg-color);
203208
}
204209

205210
.psdk-horizontal-step-icon-content {
@@ -210,15 +215,6 @@ mat-horizontal-stepper {
210215
transform: translate(-50%, -50%);
211216
}
212217

213-
.psdk-horizontal-step-icon-selected {
214-
background-color: var(--app-primary-color);
215-
color: var(--app-text-color);
216-
border-radius: 50%;
217-
height: 24px;
218-
width: 24px;
219-
position: relative;
220-
}
221-
222218
.psdk-horizontal-step-label {
223219
color: var(--text-secondary-color);
224220
font-size: 14px;
@@ -234,9 +230,12 @@ mat-horizontal-stepper {
234230
margin-left: 8px;
235231
}
236232

233+
.flex-auto {
234+
flex: auto;
235+
}
236+
237237
.psdk-horizontal-step-line {
238238
border-top: 1px solid var(--app-neutral-color);
239-
flex: auto;
240239
min-width: 32px;
241240
margin: 0px 8px;
242241
}

packages/react-sdk-components/src/components/infra/MultiStep/MultiStep.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,33 @@ export default function MultiStep(props: PropsWithChildren<MultiStepProps>) {
5656
return 'psdk-vertical-step-body';
5757
}
5858

59-
function _getHIconClass(step): string {
59+
function _getHLabelClass(step): string {
6060
if (step.ID === currentStep?.ID) {
61-
return 'psdk-horizontal-step-icon-selected';
62-
} else if (step.visited_status === 'future') {
63-
return 'psdk-horizontal-step-icon-future';
61+
return 'psdk-horizontal-step-label-selected';
6462
}
6563

66-
return 'psdk-horizontal-step-icon';
64+
return 'psdk-horizontal-step-label';
6765
}
6866

69-
function _getHLabelClass(step): string {
70-
if (step.ID === currentStep?.ID) {
71-
return 'psdk-horizontal-step-label-selected';
67+
function _getAutoFlexClass(currentStep): string {
68+
const currentStepIndex = arNavigationSteps.findIndex(step => step.ID === currentStep?.ID);
69+
const len = arNavigationSteps.length;
70+
71+
console.log('Current Step Index:', currentStep, arNavigationSteps.length - 2);
72+
73+
if (currentStepIndex === arNavigationSteps.length - 2 && arNavigationSteps[len - 1].visited_status === 'current') {
74+
return 'flex-auto';
7275
}
7376

74-
return 'psdk-horizontal-step-label';
77+
if (currentStep.visited_status === 'current') {
78+
return 'flex-auto';
79+
}
80+
81+
if (currentStep.visited_status === 'current') {
82+
return 'flex-auto';
83+
}
84+
85+
return '';
7586
}
7687

7788
function _showHLine(index: number): boolean {
@@ -144,15 +155,15 @@ export default function MultiStep(props: PropsWithChildren<MultiStepProps>) {
144155
{arNavigationSteps.map((mainStep, index) => {
145156
return (
146157
<React.Fragment key={mainStep.actionID}>
147-
<div className='psdk-horizontal-step-header'>
148-
<div className={_getHIconClass(mainStep)}>
158+
<div className={`psdk-horizontal-step-header ${mainStep.visited_status}`}>
159+
<div className='psdk-horizontal-step-icon'>
149160
<div className='psdk-horizontal-step-icon-content'>
150161
<span>{index + 1}</span>
151162
</div>
152163
</div>
153164
<div className={_getHLabelClass(mainStep)}>{mainStep.visited_status === 'current' && mainStep.name}</div>
154165
</div>
155-
{_showHLine(index) && <div className='psdk-horizontal-step-line' />}
166+
{_showHLine(index) && <div className={`psdk-horizontal-step-line ${_getAutoFlexClass(mainStep)}`} />}
156167
</React.Fragment>
157168
);
158169
})}

0 commit comments

Comments
 (0)