import clsx from 'clsx'
import React, { ReactNode } from 'react'
import { formatMoney } from 'common/util/format'
import { Col } from './layout/col'
import { Row } from './layout/row'
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 (
{replaceYesButton ? (
replaceYesButton
) : (
)}
{replaceNoButton ? (
replaceNoButton
) : (
)}
)
}
export function YesNoCancelSelector(props: {
selected: resolution | undefined
onSelect: (selected: resolution) => void
className?: string
btnClassName?: string
}) {
const { selected, onSelect } = props
const btnClassName = clsx('px-6 flex-1 rounded-3xl', props.btnClassName)
return (
{/* Should ideally use a radio group instead of buttons */}
)
}
export function ChooseCancelSelector(props: {
selected: 'CHOOSE' | 'CHOOSE_MULTIPLE' | 'CANCEL' | undefined
onSelect: (selected: 'CHOOSE' | 'CHOOSE_MULTIPLE' | 'CANCEL') => void
className?: string
btnClassName?: string
}) {
const { selected, onSelect, className } = props
const btnClassName = clsx('px-6 flex-1', props.btnClassName)
return (
)
}
const fundAmounts = [1000, 2500, 10000]
export function FundsSelector(props: {
selected: 1000 | 2500 | 10000
onSelect: (selected: 1000 | 2500 | 10000) => void
className?: string
btnClassName?: string
}) {
const { selected, onSelect, className } = props
const btnClassName = clsx('!px-2 whitespace-nowrap', props.btnClassName)
return (
{fundAmounts.map((amount) => (
))}
)
}
export function BuyButton(props: { className?: string; onClick?: () => void }) {
const { className, onClick } = props
// Note: styles coppied from YesNoSelector
return (
)
}
export function NumberCancelSelector(props: {
selected: 'NUMBER' | 'CANCEL' | undefined
onSelect: (selected: 'NUMBER' | 'CANCEL') => void
className?: string
btnClassName?: string
}) {
const { selected, onSelect, className } = props
const btnClassName = clsx('px-6 flex-1', props.btnClassName)
return (
)
}
function Button(props: {
className?: string
onClick?: () => void
color: 'green' | 'red' | 'blue' | 'indigo' | 'yellow' | 'gray'
children?: ReactNode
}) {
const { className, onClick, children, color } = props
return (
)
}