11import React , { useState , useEffect , ReactElement } from 'react' ;
2- import './styles.css ' ;
2+ import styles from './styles' ;
33import { Istep , IstepperProps } from './types' ;
44import whiteTick from '../assets/white-tick.svg' ;
55import { STEP_STATUSES } from './constants' ;
@@ -21,44 +21,49 @@ const Stepper = (props: IstepperProps): ReactElement => {
2121 }
2222
2323 return (
24- < div className = " stepperContainer" >
24+ < div style = { styles . stepperContainer } >
2525 { steps ?. map ( ( step : Istep , index : number ) : ReactElement => (
26- < div key = { index } className = " eachStep" >
27- < div className = ' bubbleLineWrapper' >
26+ < div key = { index } style = { styles . eachStep } >
27+ < div style = { styles . bubbleLineWrapper } >
2828 < div
29- className = { `eachBubble
30- ${ enableStepClick && 'cursorPointer' }
31- ${ index === currentActiveStepIndexVal && 'activeStepBubble' }
32- ${ ( step . status === STEP_STATUSES . UNVISITED && currentActiveStepIndexVal !== index ) && 'inactiveStepBubble' } ` }
29+ style = { { ...styles . eachBubble ,
30+ ...( ( enableStepClick && styles . cursorPointer ) || { } ) ,
31+ ...( ( index === currentActiveStepIndexVal ) && styles . activeStepBubble || { } ) ,
32+ ...( ( step . status === STEP_STATUSES . UNVISITED && currentActiveStepIndexVal !== index ) && styles . inactiveStepBubble || { } )
33+ } }
3334 onClick = { ( ) : void => handleStepClick ( index ) }
35+ role = "presentation"
3436 >
3537 { step ?. status === STEP_STATUSES . COMPLETED && (
3638 < img
3739 src = { whiteTick }
38- className = " whiteTickImg"
40+ style = { styles . whiteTickImg }
3941 alt = ""
4042 />
4143 )
4244 || index + 1 }
4345 </ div >
44- < div className = ' eachLabel' >
45- { step . label && (
46+ < div style = { styles . eachLabel } >
47+ { step ? .label && (
4648 < span
47- className = { `labelTitle ${ index === currentActiveStepIndexVal && 'activeLabelTitle' } ` }
49+ style = { { ...styles . labelTitle ,
50+ ...( ( index === currentActiveStepIndexVal && styles . activeLabelTitle ) || { } ) } }
4851 onClick = { ( ) : void => handleStepClick ( index ) }
4952 role = "presentation"
5053 >
51- { step ? .label }
54+ { step . label }
5255 </ span >
5356 ) }
5457 { step ?. description && (
55- < span className = { `labelDescription ${ index === currentActiveStepIndexVal && 'activeLabelDescription' } ` } >
56- { step ?. description }
58+ < span style = { { ...styles . labelDescription ,
59+ ...( ( index === currentActiveStepIndexVal ) && styles . activeLabelDescription || { } ) } } >
60+ { step . description }
5761 </ span >
5862 ) }
5963 </ div >
6064 { index < steps ?. length - 1 && (
61- < div className = { `lineSeparator ${ ( index > currentActiveStepIndexVal - 1 ) && 'activeStepLineSeparator' } ` } />
65+ < div style = { { ...styles . lineSeparator ,
66+ ...( ( index > currentActiveStepIndexVal - 1 ) && styles . activeStepLineSeparator || { } ) } } />
6267 ) }
6368 </ div >
6469 </ div >
0 commit comments