geändert auf FormContext - **WOP**
This commit is contained in:
34
src/components/FandStattVer.jsx
Normal file
34
src/components/FandStattVer.jsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { useState } from 'react'
|
||||
import { useFormData } from './FormContext.jsx'
|
||||
|
||||
export default function FandStattVer({left, right, onNext, isCompleted}) {
|
||||
const { formData, updateFormData } = useFormData()
|
||||
const [auswahl, setAuswahl] = useState(formData.stattgefunden || '')
|
||||
const handleOK = () => {
|
||||
if(!auswahl) {
|
||||
alert('Bitte ja/nein wäölen')
|
||||
return
|
||||
}
|
||||
updateFormData('stattgefunden', auswahl)
|
||||
onNext(auswahl)
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<h3>Fand die Führung statt?</h3>
|
||||
<div className="fstdiv">
|
||||
<label className="fsLabel">
|
||||
<input type="radio" name="fst" value={left} checked={auswahl === left}
|
||||
onChange = {(e) => setAuswahl(e.target.value)} />
|
||||
{left}
|
||||
</label>
|
||||
<label className="fsLabel">
|
||||
<input type="radio" name="fst" value={right} checked={auswahl === right}
|
||||
onChange = {(e) => setAuswahl(e.target.value)} />
|
||||
{right}
|
||||
</label>
|
||||
<button className="okbutton" onClick={handleOK} disabled = {!auswahl}>OK</button>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user