mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
change wizard a bit
This commit is contained in:
@@ -22,7 +22,26 @@ function WizardInternal() {
|
|||||||
const isLastStep = currentStep === STEPS.length - 1
|
const isLastStep = currentStep === STEPS.length - 1
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form>
|
<Form
|
||||||
|
onSubmit={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
const fd = new FormData(event.currentTarget)
|
||||||
|
for (const [key, value] of fd.entries()) {
|
||||||
|
console.log(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(state)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
if (!isLastStep) {
|
||||||
|
dispatch({ type: ACTIONS.NEXT_STEP })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dispatch({ type: ACTIONS.SUBMIT })
|
||||||
|
}}
|
||||||
|
>
|
||||||
{STEPS.map(({ id, component: Component }, index) => (
|
{STEPS.map(({ id, component: Component }, index) => (
|
||||||
<>{currentStep === index && <Component />}</>
|
<>{currentStep === index && <Component />}</>
|
||||||
))}
|
))}
|
||||||
@@ -34,14 +53,8 @@ function WizardInternal() {
|
|||||||
Zurück
|
Zurück
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!isLastStep && (
|
{!isLastStep && <Button type="submit">Weiter</Button>}
|
||||||
<Button onClick={() => dispatch({ type: ACTIONS.NEXT_STEP })}>
|
{isLastStep && <Button>Absenden</Button>}
|
||||||
Weiter
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
{isLastStep && (
|
|
||||||
<Button onClick={() => console.log('SEND OFF', state)}>Absenden</Button>
|
|
||||||
)}
|
|
||||||
</Form>
|
</Form>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user