-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MobileStepper): Add cozy design to MUI export
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
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
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,43 @@ | ||
```jsx | ||
import { useState } from 'react' | ||
import MobileStepper from 'cozy-ui/transpiled/react/MobileStepper' | ||
import IconButton from 'cozy-ui/transpiled/react/IconButton' | ||
import Icon from 'cozy-ui/transpiled/react/Icon' | ||
import LeftIcon from 'cozy-ui/transpiled/react/Icons/Left' | ||
import RightIcon from 'cozy-ui/transpiled/react/Icons/Right' | ||
|
||
const maxSteps = 5 | ||
const [activeStep, setActiveStep] = useState(0) | ||
|
||
const handleNext = () => { | ||
setActiveStep(activeStep + 1) | ||
} | ||
|
||
const handleBack = () => { | ||
setActiveStep(activeStep - 1) | ||
} | ||
|
||
; | ||
|
||
<div class="u-flex"> | ||
<MobileStepper | ||
className="u-mh-auto" | ||
steps={maxSteps} | ||
position="static" | ||
activeStep={activeStep} | ||
nextButton={ | ||
<IconButton | ||
onClick={handleNext} | ||
disabled={activeStep === maxSteps - 1} | ||
> | ||
<Icon icon={RightIcon} /> | ||
</IconButton> | ||
} | ||
backButton={ | ||
<IconButton onClick={handleBack} disabled={activeStep === 0}> | ||
<Icon icon={LeftIcon} /> | ||
</IconButton> | ||
} | ||
/> | ||
</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