Tweak bet input to let you clear 0.
This commit is contained in:
parent
ae8f7b76f5
commit
f602561323
|
@ -11,6 +11,11 @@ export function BetPanel(props: { contract: Contract; className?: string }) {
|
||||||
const [betChoice, setBetChoice] = useState<'YES' | 'NO'>('YES')
|
const [betChoice, setBetChoice] = useState<'YES' | 'NO'>('YES')
|
||||||
const [betAmount, setBetAmount] = useState<number | undefined>(undefined)
|
const [betAmount, setBetAmount] = useState<number | undefined>(undefined)
|
||||||
|
|
||||||
|
function onBetChange(str: string) {
|
||||||
|
const amount = parseInt(str)
|
||||||
|
setBetAmount(isNaN(amount) ? undefined : amount)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className={'bg-gray-600 p-6 rounded ' + className}>
|
<Col className={'bg-gray-600 p-6 rounded ' + className}>
|
||||||
<div className="p-2 font-medium">Pick outcome</div>
|
<div className="p-2 font-medium">Pick outcome</div>
|
||||||
|
@ -31,9 +36,8 @@ export function BetPanel(props: { contract: Contract; className?: string }) {
|
||||||
style={{ maxWidth: 80 }}
|
style={{ maxWidth: 80 }}
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
value={betAmount}
|
value={betAmount ?? ''}
|
||||||
onChange={(e) => setBetAmount(parseInt(e.target.value) || 0)}
|
onChange={(e) => onBetChange(e.target.value)}
|
||||||
onFocus={(e) => e.target.select()}
|
|
||||||
/>
|
/>
|
||||||
<div className="ml-3">points</div>
|
<div className="ml-3">points</div>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user