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