geändert auf FormContext - **WOP**

This commit is contained in:
rxf
2025-10-26 20:33:29 +01:00
parent 63aa295562
commit e3af52a2a0
14 changed files with 1982 additions and 85 deletions

View File

@@ -0,0 +1,55 @@
import { useState } from 'react'
function FandStattVer({ left, right, onNext, isCompleted }) {
const [auswahl, setAuswahl] = useState('')
const handleOK = () => {
if (auswahl) {
// Rufe onNext mit der Auswahl ('ja' oder 'nein') auf
onNext(auswahl)
} else {
alert('Bitte eine Option auswählen')
}
}
return (
<div className={`component-box ${isCompleted ? 'completed' : ''}`}>
<h3>Fand die Veranstaltung statt?</h3>
<div className="radio-group">
<label>
<input
type="radio"
name="fandstatt"
value={left}
checked={auswahl === left}
onChange={(e) => setAuswahl(e.target.value)}
disabled={isCompleted}
/>
{left}
</label>
<label>
<input
type="radio"
name="fandstatt"
value={right}
checked={auswahl === right}
onChange={(e) => setAuswahl(e.target.value)}
disabled={isCompleted}
/>
{right}
</label>
</div>
{!isCompleted && (
<button onClick={handleOK} disabled={!auswahl}>
OK
</button>
)}
</div>
)
}
export default FandStattVer