geändert auf FormContext - **WOP**
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
export default function BesucherBar({title, euro}) {
|
||||
let inClass = 'infeld'
|
||||
if (euro !== '') {
|
||||
inClass = 'infeldsm'
|
||||
}
|
||||
return(
|
||||
import { useState, useSyncExternalStore } from 'react'
|
||||
|
||||
export default function BesucherBar({title, euro, onNext, isCompleted}) {
|
||||
|
||||
const [wert, setWert] = useState('')
|
||||
const handleOK = () => {
|
||||
if (wert) {
|
||||
onNext()
|
||||
} else {
|
||||
alert('Bitte einen Wert eingeben')
|
||||
}
|
||||
}
|
||||
|
||||
return(
|
||||
<section id="besucherbar">
|
||||
<h3>{title}:</h3>
|
||||
<div className="besadiv">
|
||||
<input className={inClass} />
|
||||
<input type='number' value={wert} onChange = {(e) => setWert(e.target.value)}
|
||||
placeholder={euro ? 'Betrag in Euro' : 'Anzahl'} disabled ={isCompleted}
|
||||
/>
|
||||
{euro}
|
||||
<button className="okbutton">OK</button>
|
||||
<button className="okbutton" onClick={handleOK} disabled = {!wert}>OK</button>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user