|
1 | 1 | import React from 'react'; |
2 | 2 |
|
3 | 3 | import { Badge, Box, Button, Col, descriptors, Flex, Icon, Spinner, Text, useLocalizations } from '@/customizables'; |
4 | | -import { CaretLeft, CaretRight } from '@/icons'; |
| 4 | +import { CaretLeft, CaretRight, Check } from '@/icons'; |
5 | 5 | import { Route, Switch, useRouter } from '@/router'; |
6 | 6 |
|
7 | 7 | import { useConfigureSSOFlow } from '../ConfigureSSOContext'; |
@@ -54,6 +54,7 @@ function extractSteps(children: React.ReactNode): ConfigureSSOWizardActiveStep[] |
54 | 54 | id: props.id, |
55 | 55 | path: props.path, |
56 | 56 | label: props.label, |
| 57 | + isCompleted: props.isCompleted, |
57 | 58 | children: props.children, |
58 | 59 | }); |
59 | 60 | }); |
@@ -177,8 +178,8 @@ const RootInner = ({ parentWizard, isNested, children }: RootInnerProps): JSX.El |
177 | 178 | goPrev, |
178 | 179 | goToStep, |
179 | 180 | isNested, |
180 | | - isFirstStep: index <= 0 && !parentWizard, |
181 | | - isLastStep: index === activeSteps.length - 1 && !parentWizard, |
| 181 | + isFirstStep: index <= 0 && (!parentWizard || parentWizard.isFirstStep), |
| 182 | + isLastStep: index === activeSteps.length - 1 && (!parentWizard || parentWizard.isLastStep), |
182 | 183 | }; |
183 | 184 | }, [activeSteps, currentStep, isLoading, goNext, goPrev, goToStep, isNested, parentWizard]); |
184 | 185 |
|
@@ -285,8 +286,8 @@ const Header = (): JSX.Element => { |
285 | 286 | > |
286 | 287 | {activeSteps.map((step, index) => { |
287 | 288 | const isCurrent = index === currentIndex; |
288 | | - const isCompleted = index < currentIndex; |
289 | | - const isReachable = index <= currentIndex; |
| 289 | + const isCompleted = step.isCompleted ?? index < currentIndex; |
| 290 | + const isReachable = isCompleted || index <= currentIndex; |
290 | 291 | const labelText = step.label ? (typeof step.label === 'string' ? step.label : t(step.label)) : ''; |
291 | 292 |
|
292 | 293 | return ( |
@@ -326,12 +327,23 @@ const Header = (): JSX.Element => { |
326 | 327 | backgroundColor: isCurrent |
327 | 328 | ? theme.colors.$colorForeground |
328 | 329 | : isCompleted |
329 | | - ? theme.colors.$neutralAlpha200 |
| 330 | + ? theme.colors.$success500 |
330 | 331 | : theme.colors.$neutralAlpha100, |
331 | | - color: isCurrent ? theme.colors.$colorBackground : theme.colors.$colorMutedForeground, |
| 332 | + color: isCurrent |
| 333 | + ? theme.colors.$colorBackground |
| 334 | + : isCompleted |
| 335 | + ? theme.colors.$white |
| 336 | + : theme.colors.$colorMutedForeground, |
332 | 337 | })} |
333 | 338 | > |
334 | | - {index + 1} |
| 339 | + {isCompleted && !isCurrent ? ( |
| 340 | + <Icon |
| 341 | + icon={Check} |
| 342 | + size='xs' |
| 343 | + /> |
| 344 | + ) : ( |
| 345 | + index + 1 |
| 346 | + )} |
335 | 347 | </Flex> |
336 | 348 | <Text |
337 | 349 | elementDescriptor={descriptors.configureSSOWizardHeaderItemLabel} |
|
0 commit comments