-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allowed passing customized icon for completed steps in
Stepper
(#2345)
- Loading branch information
Showing
10 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@itwin/itwinui-react': minor | ||
--- | ||
|
||
`Stepper` now allows passing custom icon or content in each step circle to indicate step completion. This can be done by using a `stepContent` property in each item of the `steps` array. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.demo-container { | ||
min-width: min(100%, 400px); | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--iui-size-m); | ||
} | ||
|
||
.demo-stepper { | ||
align-self: stretch; | ||
} | ||
|
||
.demo-button-container { | ||
display: flex; | ||
gap: var(--iui-size-xs); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import * as React from 'react'; | ||
import { Button, Stepper } from '@itwin/itwinui-react'; | ||
import { SvgCheckmarkSmall } from '@itwin/itwinui-icons-react'; | ||
|
||
export default () => { | ||
const [currentStep, setCurrentStep] = React.useState(0); | ||
|
||
const steps = Array(4) | ||
.fill() | ||
.map((_, index) => ({ | ||
name: `Step ${index + 1}`, | ||
stepContent: () => (index < currentStep ? <SvgCheckmarkSmall /> : null), | ||
})); | ||
|
||
return ( | ||
<div className='demo-container'> | ||
<div className='demo-stepper'> | ||
<Stepper | ||
currentStep={currentStep} | ||
steps={steps} | ||
onStepClick={(index) => { | ||
setCurrentStep(index); | ||
}} | ||
/> | ||
</div> | ||
|
||
<div className='demo-button-container'> | ||
<Button | ||
disabled={currentStep === 0} | ||
onClick={() => { | ||
if (currentStep !== 0) { | ||
setCurrentStep(currentStep - 1); | ||
} | ||
}} | ||
> | ||
Previous | ||
</Button> | ||
<Button | ||
styleType='cta' | ||
disabled={currentStep === steps.length - 1} | ||
onClick={() => { | ||
if (currentStep < steps.length - 1) { | ||
setCurrentStep(currentStep + 1); | ||
} | ||
}} | ||
> | ||
Next | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters