feat: remove state and get it from parent

This commit is contained in:
RadoslavDimchev 2023-08-24 10:49:18 +03:00
parent 9fb539dee0
commit f0da1baa19
1 changed files with 10 additions and 8 deletions

View File

@ -1,10 +1,12 @@
import { useState } from 'react'
import { Stepper, Step } from 'react-form-stepper' import { Stepper, Step } from 'react-form-stepper'
import './FormStepper.css' import './FormStepper.css'
const FormStepper = () => { type FormStepperProps = {
const [activeStep, setActiveStep] = useState<number>(0) activeStep: number
changeActiveStep: (step: number) => void
}
const FormStepper = ({ activeStep, changeActiveStep }: FormStepperProps) => {
return ( return (
<Stepper <Stepper
activeStep={activeStep} activeStep={activeStep}
@ -16,31 +18,31 @@ const FormStepper = () => {
<Step <Step
className="custom-step" className="custom-step"
label={'Overview'} label={'Overview'}
onClick={() => setActiveStep(0)} onClick={() => changeActiveStep(0)}
completed={activeStep >= 0} completed={activeStep >= 0}
/> />
<Step <Step
className="custom-step" className="custom-step"
label="Advicsories" label="Advicsories"
onClick={() => setActiveStep(1)} onClick={() => changeActiveStep(1)}
completed={activeStep > 0} completed={activeStep > 0}
/> />
<Step <Step
label="Validator Setup" label="Validator Setup"
className="custom-step" className="custom-step"
onClick={() => setActiveStep(2)} onClick={() => changeActiveStep(2)}
completed={activeStep > 1} completed={activeStep > 1}
/> />
<Step <Step
label="Key Generation" label="Key Generation"
className="custom-step" className="custom-step"
onClick={() => setActiveStep(3)} onClick={() => changeActiveStep(3)}
completed={activeStep > 2} completed={activeStep > 2}
/> />
<Step <Step
label="Activation" label="Activation"
className="custom-step" className="custom-step"
onClick={() => setActiveStep(4)} onClick={() => changeActiveStep(4)}
completed={activeStep > 3} completed={activeStep > 3}
/> />
</Stepper> </Stepper>