Clean up extra wrapper and CSS on BetRow (#178)

This commit is contained in:
Marshall Polaris 2022-05-11 14:35:50 -07:00 committed by GitHub
parent 02ed9bf7e1
commit 1063897c7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 38 deletions

View File

@ -303,6 +303,7 @@ function BuyPanel(props: {
<>
<YesNoSelector
className="mb-4"
btnClassName="flex-1"
selected={betChoice}
onSelect={(choice) => onBetChoice(choice)}
/>

View File

@ -15,9 +15,9 @@ import { useSaveShares } from './use-save-shares'
export default function BetRow(props: {
contract: FullContract<DPM | CPMM, Binary>
className?: string
labelClassName?: string
btnClassName?: string
}) {
const { className, labelClassName, contract } = props
const { className, btnClassName, contract } = props
const [open, setOpen] = useState(false)
const [betChoice, setBetChoice] = useState<'YES' | 'NO' | undefined>(
undefined
@ -31,38 +31,34 @@ export default function BetRow(props: {
return (
<>
<Row className={clsx('mt-2 justify-end space-x-3', className)}>
{/* <div className={clsx('mr-2 text-gray-400', labelClassName)}>
Place a trade
</div> */}
<YesNoSelector
btnClassName="btn-sm w-24"
onSelect={(choice) => {
setOpen(true)
setBetChoice(choice)
}}
replaceNoButton={
yesFloorShares > 0 ? (
<SellButton
contract={contract}
user={user}
sharesOutcome={'YES'}
shares={yesShares}
/>
) : undefined
}
replaceYesButton={
noFloorShares > 0 ? (
<SellButton
contract={contract}
user={user}
sharesOutcome={'NO'}
shares={noShares}
/>
) : undefined
}
/>
</Row>
<YesNoSelector
className={clsx('mt-2 justify-end', className)}
btnClassName={clsx('btn-sm w-24', btnClassName)}
onSelect={(choice) => {
setOpen(true)
setBetChoice(choice)
}}
replaceNoButton={
yesFloorShares > 0 ? (
<SellButton
contract={contract}
user={user}
sharesOutcome={'YES'}
shares={yesShares}
/>
) : undefined
}
replaceYesButton={
noFloorShares > 0 ? (
<SellButton
contract={contract}
user={user}
sharesOutcome={'NO'}
shares={noShares}
/>
) : undefined
}
/>
<Modal open={open} setOpen={setOpen}>
<BetPanelSwitcher
contract={contract}

View File

@ -53,9 +53,7 @@ export const ContractOverview = (props: {
<Row className="items-center justify-between gap-4 xl:hidden">
<BinaryResolutionOrChance contract={contract} />
{tradingAllowed(contract) && (
<BetRow contract={contract} labelClassName="hidden" />
)}
{tradingAllowed(contract) && <BetRow contract={contract} />}
</Row>
) : (
outcomeType === 'FREE_RESPONSE' &&

View File

@ -22,7 +22,7 @@ export function YesNoSelector(props: {
} = props
const commonClassNames =
'inline-flex flex-1 items-center justify-center rounded-3xl border-2 p-2'
'inline-flex items-center justify-center rounded-3xl border-2 p-2'
return (
<Row className={clsx('space-x-3', className)}>