geändert auf FormContext - **WOP**
This commit is contained in:
55
src/components/FandStattVer.jsx_claude
Normal file
55
src/components/FandStattVer.jsx_claude
Normal 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
|
||||
Reference in New Issue
Block a user