2022-01-30 21:51:30 +00:00
|
|
|
import { Row } from './layout/row'
|
|
|
|
|
|
|
|
export function ProbabilitySelector(props: {
|
|
|
|
probabilityInt: number
|
|
|
|
setProbabilityInt: (p: number) => void
|
|
|
|
isSubmitting?: boolean
|
|
|
|
}) {
|
2022-04-30 17:05:43 +00:00
|
|
|
const { probabilityInt, setProbabilityInt, isSubmitting } = props
|
2022-01-30 21:51:30 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Row className="items-center gap-2">
|
|
|
|
<label className="input-group input-group-lg w-fit text-lg">
|
|
|
|
<input
|
|
|
|
type="number"
|
|
|
|
value={probabilityInt}
|
|
|
|
className="input input-bordered input-md text-lg"
|
|
|
|
disabled={isSubmitting}
|
2022-04-30 17:05:43 +00:00
|
|
|
min={1}
|
|
|
|
max={99}
|
2022-01-30 21:51:30 +00:00
|
|
|
onChange={(e) =>
|
|
|
|
setProbabilityInt(parseInt(e.target.value.substring(0, 2)))
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
<span>%</span>
|
|
|
|
</label>
|
|
|
|
<input
|
|
|
|
type="range"
|
|
|
|
className="range range-primary"
|
2022-04-30 17:05:43 +00:00
|
|
|
min={1}
|
|
|
|
max={99}
|
2022-01-30 21:51:30 +00:00
|
|
|
value={probabilityInt}
|
|
|
|
onChange={(e) => setProbabilityInt(parseInt(e.target.value))}
|
|
|
|
/>
|
|
|
|
</Row>
|
|
|
|
)
|
|
|
|
}
|