Fix limit prob styling
This commit is contained in:
parent
47eb8abed0
commit
4a139c5cc2
|
@ -631,9 +631,9 @@ function LimitOrderPanel(props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className={hidden ? 'hidden' : ''}>
|
<Col className={hidden ? 'hidden' : ''}>
|
||||||
<Row className="mt-1 items-center gap-4">
|
<Row className="mt-1 mb-4 items-center gap-4">
|
||||||
<Col className="gap-2">
|
<Col className="gap-2">
|
||||||
<div className="relative ml-1 text-sm text-gray-500">
|
<div className="text-sm text-gray-500">
|
||||||
Buy {isPseudoNumeric ? <HigherLabel /> : <YesLabel />} up to
|
Buy {isPseudoNumeric ? <HigherLabel /> : <YesLabel />} up to
|
||||||
</div>
|
</div>
|
||||||
<ProbabilityOrNumericInput
|
<ProbabilityOrNumericInput
|
||||||
|
@ -641,10 +641,11 @@ function LimitOrderPanel(props: {
|
||||||
prob={lowLimitProb}
|
prob={lowLimitProb}
|
||||||
setProb={setLowLimitProb}
|
setProb={setLowLimitProb}
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
|
placeholder="10"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col className="gap-2">
|
<Col className="gap-2">
|
||||||
<div className="ml-1 text-sm text-gray-500">
|
<div className="text-sm text-gray-500">
|
||||||
Buy {isPseudoNumeric ? <LowerLabel /> : <NoLabel />} down to
|
Buy {isPseudoNumeric ? <LowerLabel /> : <NoLabel />} down to
|
||||||
</div>
|
</div>
|
||||||
<ProbabilityOrNumericInput
|
<ProbabilityOrNumericInput
|
||||||
|
@ -652,6 +653,7 @@ function LimitOrderPanel(props: {
|
||||||
prob={highLimitProb}
|
prob={highLimitProb}
|
||||||
setProb={setHighLimitProb}
|
setProb={setHighLimitProb}
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
|
placeholder="90"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
@ -13,7 +13,7 @@ export const Input = (
|
||||||
'h-12 rounded-md border bg-white px-4 shadow-sm transition-colors invalid:border-red-600 invalid:text-red-900 invalid:placeholder-red-300 focus:outline-none disabled:cursor-not-allowed disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 md:text-sm',
|
'h-12 rounded-md border bg-white px-4 shadow-sm transition-colors invalid:border-red-600 invalid:text-red-900 invalid:placeholder-red-300 focus:outline-none disabled:cursor-not-allowed disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 md:text-sm',
|
||||||
error
|
error
|
||||||
? 'border-red-300 text-red-900 placeholder-red-300 focus:border-red-600 focus:ring-red-500' // matches invalid: styles
|
? 'border-red-300 text-red-900 placeholder-red-300 focus:border-red-600 focus:ring-red-500' // matches invalid: styles
|
||||||
: 'border-gray-300 focus:border-indigo-500 focus:ring-indigo-500',
|
: 'placeholder-greyscale-4 border-gray-300 focus:border-indigo-500 focus:ring-indigo-500',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...rest}
|
{...rest}
|
||||||
|
|
|
@ -4,18 +4,15 @@ import { getPseudoProbability } from 'common/pseudo-numeric'
|
||||||
import { BucketInput } from './bucket-input'
|
import { BucketInput } from './bucket-input'
|
||||||
import { Input } from './input'
|
import { Input } from './input'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { Spacer } from './layout/spacer'
|
|
||||||
|
|
||||||
export function ProbabilityInput(props: {
|
function ProbabilityInput(props: {
|
||||||
prob: number | undefined
|
prob: number | undefined
|
||||||
onChange: (newProb: number | undefined) => void
|
onChange: (newProb: number | undefined) => void
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
className?: string
|
|
||||||
inputClassName?: string
|
inputClassName?: string
|
||||||
}) {
|
}) {
|
||||||
const { prob, onChange, disabled, placeholder, className, inputClassName } =
|
const { prob, onChange, disabled, placeholder, inputClassName } = props
|
||||||
props
|
|
||||||
|
|
||||||
const onProbChange = (str: string) => {
|
const onProbChange = (str: string) => {
|
||||||
let prob = parseInt(str.replace(/\D/g, ''))
|
let prob = parseInt(str.replace(/\D/g, ''))
|
||||||
|
@ -29,10 +26,10 @@ export function ProbabilityInput(props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className={className}>
|
<Col>
|
||||||
<label className="flex w-full items-stretch">
|
<label className="relative w-fit">
|
||||||
<Input
|
<Input
|
||||||
className={clsx('max-w-[200px] !text-lg', inputClassName)}
|
className={clsx('pr-2 !text-lg', inputClassName)}
|
||||||
type="number"
|
type="number"
|
||||||
max={99}
|
max={99}
|
||||||
min={1}
|
min={1}
|
||||||
|
@ -44,9 +41,10 @@ export function ProbabilityInput(props: {
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onChange={(e) => onProbChange(e.target.value)}
|
onChange={(e) => onProbChange(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<span className="bg-gray-200 text-sm">%</span>
|
<span className="text-greyscale-4 absolute top-1/2 right-10 my-auto -translate-y-1/2">
|
||||||
|
%
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<Spacer h={4} />
|
|
||||||
</Col>
|
</Col>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -82,7 +80,7 @@ export function ProbabilityOrNumericInput(props: {
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ProbabilityInput
|
<ProbabilityInput
|
||||||
inputClassName="w-full max-w-none"
|
inputClassName="w-24"
|
||||||
prob={prob}
|
prob={prob}
|
||||||
onChange={setProb}
|
onChange={setProb}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user