Put back old Yes/No bet buttons
This commit is contained in:
parent
0be38c4e09
commit
ec682788e0
|
@ -40,6 +40,7 @@ import { useUnfilledBets } from 'web/hooks/use-bets'
|
||||||
import { LimitBets } from './limit-bets'
|
import { LimitBets } from './limit-bets'
|
||||||
import { BucketInput } from './bucket-input'
|
import { BucketInput } from './bucket-input'
|
||||||
import { PillButton } from './buttons/pill-button'
|
import { PillButton } from './buttons/pill-button'
|
||||||
|
import { YesNoSelector } from './yes-no-selector'
|
||||||
|
|
||||||
export function BetPanel(props: {
|
export function BetPanel(props: {
|
||||||
contract: CPMMBinaryContract | PseudoNumericContract
|
contract: CPMMBinaryContract | PseudoNumericContract
|
||||||
|
@ -268,25 +269,16 @@ function BuyPanel(props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="my-3 text-left text-sm text-gray-500">Direction</div>
|
<div className="my-3 text-left text-sm text-gray-500">
|
||||||
<Row className="mb-4 items-center gap-2">
|
{isPseudoNumeric ? 'Direction' : 'Outcome'}
|
||||||
<PillButton
|
</div>
|
||||||
selected={betChoice === 'YES'}
|
<YesNoSelector
|
||||||
onSelect={() => onBetChoice('YES')}
|
className="mb-4"
|
||||||
big
|
btnClassName="flex-1"
|
||||||
color="bg-primary"
|
selected={betChoice}
|
||||||
>
|
onSelect={(choice) => onBetChoice(choice)}
|
||||||
{isPseudoNumeric ? 'Higher' : 'Yes'}
|
isPseudoNumeric={isPseudoNumeric}
|
||||||
</PillButton>
|
/>
|
||||||
<PillButton
|
|
||||||
selected={betChoice === 'NO'}
|
|
||||||
onSelect={() => onBetChoice('NO')}
|
|
||||||
big
|
|
||||||
color="bg-red-400"
|
|
||||||
>
|
|
||||||
{isPseudoNumeric ? 'Lower' : 'No'}
|
|
||||||
</PillButton>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<div className="my-3 text-left text-sm text-gray-500">Amount</div>
|
<div className="my-3 text-left text-sm text-gray-500">Amount</div>
|
||||||
<BuyAmountInput
|
<BuyAmountInput
|
||||||
|
|
|
@ -5,6 +5,68 @@ import { Col } from './layout/col'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
import { resolution } from 'common/contract'
|
import { resolution } from 'common/contract'
|
||||||
|
|
||||||
|
export function YesNoSelector(props: {
|
||||||
|
selected?: 'YES' | 'NO'
|
||||||
|
onSelect: (selected: 'YES' | 'NO') => void
|
||||||
|
className?: string
|
||||||
|
btnClassName?: string
|
||||||
|
replaceYesButton?: React.ReactNode
|
||||||
|
replaceNoButton?: React.ReactNode
|
||||||
|
isPseudoNumeric?: boolean
|
||||||
|
}) {
|
||||||
|
const {
|
||||||
|
selected,
|
||||||
|
onSelect,
|
||||||
|
className,
|
||||||
|
btnClassName,
|
||||||
|
replaceNoButton,
|
||||||
|
replaceYesButton,
|
||||||
|
isPseudoNumeric,
|
||||||
|
} = props
|
||||||
|
|
||||||
|
const commonClassNames =
|
||||||
|
'inline-flex items-center justify-center rounded-3xl border-2 p-2'
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Row className={clsx('space-x-3', className)}>
|
||||||
|
{replaceYesButton ? (
|
||||||
|
replaceYesButton
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
className={clsx(
|
||||||
|
commonClassNames,
|
||||||
|
'hover:bg-primary-focus border-primary hover:border-primary-focus hover:text-white',
|
||||||
|
selected == 'YES'
|
||||||
|
? 'bg-primary text-white'
|
||||||
|
: 'text-primary bg-transparent',
|
||||||
|
btnClassName
|
||||||
|
)}
|
||||||
|
onClick={() => onSelect('YES')}
|
||||||
|
>
|
||||||
|
{isPseudoNumeric ? 'HIGHER' : 'YES'}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{replaceNoButton ? (
|
||||||
|
replaceNoButton
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
className={clsx(
|
||||||
|
commonClassNames,
|
||||||
|
'border-red-400 hover:border-red-500 hover:bg-red-500 hover:text-white',
|
||||||
|
selected == 'NO'
|
||||||
|
? 'bg-red-400 text-white'
|
||||||
|
: 'bg-transparent text-red-400',
|
||||||
|
btnClassName
|
||||||
|
)}
|
||||||
|
onClick={() => onSelect('NO')}
|
||||||
|
>
|
||||||
|
{isPseudoNumeric ? 'LOWER' : 'NO'}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export function YesNoCancelSelector(props: {
|
export function YesNoCancelSelector(props: {
|
||||||
selected: resolution | undefined
|
selected: resolution | undefined
|
||||||
onSelect: (selected: resolution) => void
|
onSelect: (selected: resolution) => void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user