getting rid of daisy buttons
This commit is contained in:
parent
2625ab1549
commit
0801f6a94a
|
@ -184,16 +184,13 @@ export function AnswerBetPanel(props: {
|
||||||
<Spacer h={6} />
|
<Spacer h={6} />
|
||||||
{user ? (
|
{user ? (
|
||||||
<WarningConfirmationButton
|
<WarningConfirmationButton
|
||||||
|
size="xl"
|
||||||
marketType="freeResponse"
|
marketType="freeResponse"
|
||||||
amount={betAmount}
|
amount={betAmount}
|
||||||
warning={warning}
|
warning={warning}
|
||||||
onSubmit={submitBet}
|
onSubmit={submitBet}
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
disabled={!!betDisabled}
|
disabled={!!betDisabled}
|
||||||
openModalButtonClass={clsx(
|
|
||||||
'btn self-stretch',
|
|
||||||
betDisabled ? 'btn-disabled' : 'btn-primary'
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<BetSignUpPrompt />
|
<BetSignUpPrompt />
|
||||||
|
|
|
@ -399,18 +399,12 @@ export function BuyPanel(props: {
|
||||||
warning={warning}
|
warning={warning}
|
||||||
onSubmit={submitBet}
|
onSubmit={submitBet}
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
openModalButtonClass={clsx(
|
disabled={!!betDisabled || outcome === undefined}
|
||||||
'btn mb-2 flex-1',
|
size="xl"
|
||||||
betDisabled || outcome === undefined
|
|
||||||
? 'btn-disabled bg-greyscale-2'
|
|
||||||
: outcome === 'NO'
|
|
||||||
? 'border-none bg-red-400 hover:bg-red-500'
|
|
||||||
: 'border-none bg-teal-500 hover:bg-teal-600'
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
className="text-greyscale-6 mx-auto select-none text-sm underline xl:hidden"
|
className="text-greyscale-6 mx-auto mt-3 select-none text-sm underline xl:hidden"
|
||||||
onClick={() => setSeeLimit(true)}
|
onClick={() => setSeeLimit(true)}
|
||||||
>
|
>
|
||||||
Advanced
|
Advanced
|
||||||
|
|
|
@ -46,21 +46,27 @@ export function Button(props: {
|
||||||
<button
|
<button
|
||||||
type={type}
|
type={type}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'font-md items-center justify-center rounded-md border border-transparent shadow-sm hover:transition-colors disabled:cursor-not-allowed disabled:opacity-50',
|
className,
|
||||||
|
'font-md items-center justify-center rounded-md border border-transparent shadow-sm transition-colors disabled:cursor-not-allowed',
|
||||||
sizeClasses,
|
sizeClasses,
|
||||||
color === 'green' && 'btn-primary text-white',
|
color === 'green' &&
|
||||||
color === 'red' && 'bg-red-400 text-white hover:bg-red-500',
|
'disabled:bg-greyscale-2 bg-teal-500 text-white hover:bg-teal-600',
|
||||||
color === 'yellow' && 'bg-yellow-400 text-white hover:bg-yellow-500',
|
color === 'red' &&
|
||||||
color === 'blue' && 'bg-blue-400 text-white hover:bg-blue-500',
|
'disabled:bg-greyscale-2 bg-red-400 text-white hover:bg-red-500',
|
||||||
color === 'indigo' && 'bg-indigo-500 text-white hover:bg-indigo-600',
|
color === 'yellow' &&
|
||||||
color === 'gray' && 'bg-gray-50 text-gray-600 hover:bg-gray-200',
|
'disabled:bg-greyscale-2 bg-yellow-400 text-white hover:bg-yellow-500',
|
||||||
|
color === 'blue' &&
|
||||||
|
'disabled:bg-greyscale-2 bg-blue-400 text-white hover:bg-blue-500',
|
||||||
|
color === 'indigo' &&
|
||||||
|
'disabled:bg-greyscale-2 bg-indigo-500 text-white hover:bg-indigo-600',
|
||||||
|
color === 'gray' &&
|
||||||
|
'bg-greyscale-1 text-greyscale-6 hover:bg-greyscale-2 disabled:opacity-50',
|
||||||
color === 'gradient' &&
|
color === 'gradient' &&
|
||||||
'border-none bg-gradient-to-r from-indigo-500 to-blue-500 text-white hover:from-indigo-700 hover:to-blue-700',
|
'disabled:bg-greyscale-2 border-none bg-gradient-to-r from-indigo-500 to-blue-500 text-white hover:from-indigo-700 hover:to-blue-700',
|
||||||
color === 'gray-white' &&
|
color === 'gray-white' &&
|
||||||
'text-greyscale-6 hover:bg-greyscale-2 border-none shadow-none',
|
'text-greyscale-6 hover:bg-greyscale-2 border-none shadow-none disabled:opacity-50',
|
||||||
color === 'highlight-blue' &&
|
color === 'highlight-blue' &&
|
||||||
'text-highlight-blue border-none shadow-none',
|
'text-highlight-blue disabled:bg-greyscale-2 border-none shadow-none'
|
||||||
className
|
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import { ReactNode, useState } from 'react'
|
import { ReactNode, useState } from 'react'
|
||||||
|
import { Button, SizeType } from './button'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { Modal } from './layout/modal'
|
import { Modal } from './layout/modal'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
|
@ -22,6 +23,8 @@ export function ConfirmationButton(props: {
|
||||||
onSubmit?: () => void
|
onSubmit?: () => void
|
||||||
onOpenChanged?: (isOpen: boolean) => void
|
onOpenChanged?: (isOpen: boolean) => void
|
||||||
onSubmitWithSuccess?: () => Promise<boolean>
|
onSubmitWithSuccess?: () => Promise<boolean>
|
||||||
|
disabled: boolean
|
||||||
|
size?: SizeType
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
openModalBtn,
|
openModalBtn,
|
||||||
|
@ -31,6 +34,8 @@ export function ConfirmationButton(props: {
|
||||||
children,
|
children,
|
||||||
onOpenChanged,
|
onOpenChanged,
|
||||||
onSubmitWithSuccess,
|
onSubmitWithSuccess,
|
||||||
|
disabled,
|
||||||
|
size,
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
@ -68,13 +73,16 @@ export function ConfirmationButton(props: {
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
</Modal>
|
</Modal>
|
||||||
<div
|
<Button
|
||||||
className={clsx('btn', openModalBtn.className)}
|
className={clsx(openModalBtn.className)}
|
||||||
onClick={() => updateOpen(true)}
|
onClick={() => updateOpen(true)}
|
||||||
|
disabled={disabled}
|
||||||
|
color="yellow"
|
||||||
|
size={size}
|
||||||
>
|
>
|
||||||
{openModalBtn.icon}
|
{openModalBtn.icon}
|
||||||
{openModalBtn.label}
|
{openModalBtn.label}
|
||||||
</div>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { Row } from './layout/row'
|
||||||
import { ConfirmationButton } from './confirmation-button'
|
import { ConfirmationButton } from './confirmation-button'
|
||||||
import { ExclamationIcon } from '@heroicons/react/solid'
|
import { ExclamationIcon } from '@heroicons/react/solid'
|
||||||
import { formatMoney } from 'common/util/format'
|
import { formatMoney } from 'common/util/format'
|
||||||
|
import { Button, SizeType } from './button'
|
||||||
|
|
||||||
export function WarningConfirmationButton(props: {
|
export function WarningConfirmationButton(props: {
|
||||||
amount: number | undefined
|
amount: number | undefined
|
||||||
|
@ -12,10 +13,11 @@ export function WarningConfirmationButton(props: {
|
||||||
marketType: 'freeResponse' | 'binary'
|
marketType: 'freeResponse' | 'binary'
|
||||||
warning?: string
|
warning?: string
|
||||||
onSubmit: () => void
|
onSubmit: () => void
|
||||||
disabled?: boolean
|
disabled: boolean
|
||||||
isSubmitting: boolean
|
isSubmitting: boolean
|
||||||
openModalButtonClass?: string
|
openModalButtonClass?: string
|
||||||
submitButtonClassName?: string
|
submitButtonClassName?: string
|
||||||
|
size: SizeType
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
amount,
|
amount,
|
||||||
|
@ -26,53 +28,44 @@ export function WarningConfirmationButton(props: {
|
||||||
openModalButtonClass,
|
openModalButtonClass,
|
||||||
submitButtonClassName,
|
submitButtonClassName,
|
||||||
outcome,
|
outcome,
|
||||||
marketType,
|
size,
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
if (!warning) {
|
if (!warning) {
|
||||||
return (
|
return (
|
||||||
<button
|
<Button
|
||||||
className={clsx(
|
size={size}
|
||||||
openModalButtonClass,
|
disabled={isSubmitting || disabled}
|
||||||
isSubmitting ? 'loading btn-disabled' : '',
|
className={clsx(openModalButtonClass, isSubmitting ? 'loading' : '')}
|
||||||
disabled && 'btn-disabled',
|
|
||||||
marketType === 'binary'
|
|
||||||
? !outcome
|
|
||||||
? 'btn-disabled bg-greyscale-2'
|
|
||||||
: ''
|
|
||||||
: ''
|
|
||||||
)}
|
|
||||||
onClick={onSubmit}
|
onClick={onSubmit}
|
||||||
|
color={outcome === 'NO' ? 'red' : 'green'}
|
||||||
>
|
>
|
||||||
{isSubmitting
|
{isSubmitting
|
||||||
? 'Submitting...'
|
? 'Submitting...'
|
||||||
: amount
|
: amount
|
||||||
? `Wager ${formatMoney(amount)}`
|
? `Wager ${formatMoney(amount)}`
|
||||||
: 'Wager'}
|
: 'Wager'}
|
||||||
</button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfirmationButton
|
<ConfirmationButton
|
||||||
|
disabled={isSubmitting}
|
||||||
openModalBtn={{
|
openModalBtn={{
|
||||||
className: clsx(
|
className: clsx(isSubmitting && 'loading'),
|
||||||
openModalButtonClass,
|
|
||||||
isSubmitting && 'btn-disabled loading'
|
|
||||||
),
|
|
||||||
label: amount ? `Wager ${formatMoney(amount)}` : 'Wager',
|
label: amount ? `Wager ${formatMoney(amount)}` : 'Wager',
|
||||||
}}
|
}}
|
||||||
cancelBtn={{
|
cancelBtn={{
|
||||||
label: 'Cancel',
|
label: 'Cancel',
|
||||||
className: 'btn-warning',
|
className: 'btn btn-warning',
|
||||||
}}
|
}}
|
||||||
submitBtn={{
|
submitBtn={{
|
||||||
label: 'Submit',
|
label: 'Submit',
|
||||||
className: clsx(
|
className: clsx('btn border-none btn-sm btn-ghost self-center'),
|
||||||
'border-none btn-sm btn-ghost self-center',
|
|
||||||
submitButtonClassName
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
|
size={size}
|
||||||
>
|
>
|
||||||
<Row className="items-center text-xl">
|
<Row className="items-center text-xl">
|
||||||
<ExclamationIcon
|
<ExclamationIcon
|
||||||
|
|
Loading…
Reference in New Issue
Block a user