mobile bet slider

This commit is contained in:
mantikoros 2022-09-05 17:11:32 -05:00
parent 30d73d6362
commit ae40999700
3 changed files with 31 additions and 10 deletions

View File

@ -84,6 +84,7 @@ export function BuyAmountInput(props: {
setError: (error: string | undefined) => void setError: (error: string | undefined) => void
minimumAmount?: number minimumAmount?: number
disabled?: boolean disabled?: boolean
showSliderOnMobile?: boolean
className?: string className?: string
inputClassName?: string inputClassName?: string
// Needed to focus the amount input // Needed to focus the amount input
@ -94,6 +95,7 @@ export function BuyAmountInput(props: {
onChange, onChange,
error, error,
setError, setError,
showSliderOnMobile: showSlider,
disabled, disabled,
className, className,
inputClassName, inputClassName,
@ -121,6 +123,7 @@ export function BuyAmountInput(props: {
} }
return ( return (
<>
<AmountInput <AmountInput
amount={amount} amount={amount}
onChange={onAmountChange} onChange={onAmountChange}
@ -131,5 +134,17 @@ export function BuyAmountInput(props: {
inputClassName={inputClassName} inputClassName={inputClassName}
inputRef={inputRef} inputRef={inputRef}
/> />
{showSlider && (
<input
type="range"
min="0"
max="250"
value={amount ?? 0}
onChange={(e) => onAmountChange(parseInt(e.target.value))}
className="xl:hidden"
step="25"
/>
)}
</>
) )
} }

View File

@ -136,6 +136,7 @@ export function AnswerBetPanel(props: {
Amount Amount
<span>Balance: {formatMoney(user?.balance ?? 0)}</span> <span>Balance: {formatMoney(user?.balance ?? 0)}</span>
</Row> </Row>
<BuyAmountInput <BuyAmountInput
inputClassName="w-full max-w-none" inputClassName="w-full max-w-none"
amount={betAmount} amount={betAmount}
@ -144,6 +145,7 @@ export function AnswerBetPanel(props: {
setError={setError} setError={setError}
disabled={isSubmitting} disabled={isSubmitting}
inputRef={inputRef} inputRef={inputRef}
showSliderOnMobile
/> />
{(betAmount ?? 0) > 10 && {(betAmount ?? 0) > 10 &&

View File

@ -313,6 +313,7 @@ function BuyPanel(props: {
Balance: {formatMoney(user?.balance ?? 0)} Balance: {formatMoney(user?.balance ?? 0)}
</span> </span>
</Row> </Row>
<BuyAmountInput <BuyAmountInput
inputClassName="w-full max-w-none" inputClassName="w-full max-w-none"
amount={betAmount} amount={betAmount}
@ -321,6 +322,7 @@ function BuyPanel(props: {
setError={setError} setError={setError}
disabled={isSubmitting} disabled={isSubmitting}
inputRef={inputRef} inputRef={inputRef}
showSliderOnMobile
/> />
{warning} {warning}
@ -609,6 +611,7 @@ function LimitOrderPanel(props: {
Balance: {formatMoney(user?.balance ?? 0)} Balance: {formatMoney(user?.balance ?? 0)}
</span> </span>
</Row> </Row>
<BuyAmountInput <BuyAmountInput
inputClassName="w-full max-w-none" inputClassName="w-full max-w-none"
amount={betAmount} amount={betAmount}
@ -616,6 +619,7 @@ function LimitOrderPanel(props: {
error={error} error={error}
setError={setError} setError={setError}
disabled={isSubmitting} disabled={isSubmitting}
showSliderOnMobile
/> />
<Col className="mt-3 w-full gap-3"> <Col className="mt-3 w-full gap-3">