@@ -4,27 +4,30 @@ import style from "./style/Stepper.module.scss";
44import Icon from "../Icon" ;
55
66export default function Stepper ( { steps, current, clickable, setCurrent } : StepperProps ) {
7- return (
8- < div className = { style . stepper } >
9- { steps . map ( ( step , i ) => {
10- const done = i < current ;
7+ return (
8+ < div className = { style . stepper } >
9+ { steps . map ( ( step , i ) => {
10+ const done = i < current ;
1111
12- const Element = clickable ? "button" : "div" ;
12+ const Element = clickable ? "button" : "div" ;
1313
14- const buttonProps : any = clickable
15- ? {
16- onClick : ( ) => setCurrent ( i ) ,
17- type : "button" ,
18- }
19- : { } ;
14+ const buttonProps : any = clickable
15+ ? {
16+ onClick : ( ) => setCurrent ( i ) ,
17+ type : "button" ,
18+ }
19+ : { } ;
2020
21- return (
22- < Element key = { i } className = { classes ( [ style . step , i === current ? style . active : done && style . done ] ) } { ...buttonProps } >
23- < div className = { style . badge } > { done ? < Icon icon = "check" /> : i + 1 } </ div >
24- < div className = { style . label } > { step . label } </ div >
25- </ Element >
26- ) ;
27- } ) }
28- </ div >
29- ) ;
21+ return (
22+ < Element
23+ key = { i }
24+ className = { classes ( [ style . step , i === current ? style . active : done && style . done , steps . length < 4 && style . stepWide ] ) }
25+ { ...buttonProps } >
26+ < div className = { style . badge } > { done ? < Icon icon = "check" /> : i + 1 } </ div >
27+ < div className = { style . label } > { step . label } </ div >
28+ </ Element >
29+ ) ;
30+ } ) }
31+ </ div >
32+ ) ;
3033}
0 commit comments