Convert confirmation daisy buttons to tailwind

This commit is contained in:
Ian Philips 2022-10-04 08:02:20 -06:00
parent ee4d3947b8
commit c6e5e04e65
8 changed files with 15 additions and 42 deletions

View File

@ -612,7 +612,7 @@ function SellButton(props: {
label: 'Sell', label: 'Sell',
disabled: isSubmitting, disabled: isSubmitting,
}} }}
submitBtn={{ className: 'btn-primary', label: 'Sell' }} submitBtn={{ label: 'Sell', color: 'green' }}
onSubmit={async () => { onSubmit={async () => {
setIsSubmitting(true) setIsSubmitting(true)
await sellBet({ contractId: contract.id, betId: bet.id }) await sellBet({ contractId: contract.id, betId: bet.id })

View File

@ -16,11 +16,11 @@ export function ConfirmationButton(props: {
} }
cancelBtn?: { cancelBtn?: {
label?: string label?: string
className?: string color?: ColorType
} }
submitBtn?: { submitBtn?: {
label?: string label?: string
className?: string color?: ColorType
isSubmitting?: boolean isSubmitting?: boolean
} }
children: ReactNode children: ReactNode
@ -53,14 +53,14 @@ export function ConfirmationButton(props: {
<Col className="gap-4 rounded-md bg-white px-8 py-6"> <Col className="gap-4 rounded-md bg-white px-8 py-6">
{children} {children}
<Row className="gap-4"> <Row className="gap-4">
<div <Button
className={clsx('btn', cancelBtn?.className)} color={cancelBtn?.color ?? 'gray-white'}
onClick={() => updateOpen(false)} onClick={() => updateOpen(false)}
> >
{cancelBtn?.label ?? 'Cancel'} {cancelBtn?.label ?? 'Cancel'}
</div> </Button>
<Button <Button
className={clsx('btn', submitBtn?.className)} color={submitBtn?.color ?? 'blue'}
onClick={ onClick={
onSubmitWithSuccess onSubmitWithSuccess
? () => ? () =>
@ -100,18 +100,11 @@ export function ResolveConfirmationButton(props: {
onResolve: () => void onResolve: () => void
isSubmitting: boolean isSubmitting: boolean
openModalButtonClass?: string openModalButtonClass?: string
submitButtonClass?: string
color?: ColorType color?: ColorType
disabled?: boolean disabled?: boolean
}) { }) {
const { const { onResolve, isSubmitting, openModalButtonClass, color, disabled } =
onResolve, props
isSubmitting,
openModalButtonClass,
submitButtonClass,
color,
disabled,
} = props
return ( return (
<ConfirmationButton <ConfirmationButton
openModalBtn={{ openModalBtn={{
@ -126,7 +119,7 @@ export function ResolveConfirmationButton(props: {
}} }}
submitBtn={{ submitBtn={{
label: 'Resolve', label: 'Resolve',
className: clsx('border-none', submitButtonClass), color: color,
isSubmitting, isSubmitting,
}} }}
onSubmit={onResolve} onSubmit={onResolve}

View File

@ -50,14 +50,6 @@ export function ContractReportResolution(props: { contract: Contract }) {
icon: <FlagIcon className="h-5 w-5" />, icon: <FlagIcon className="h-5 w-5" />,
className: clsx(flagClass, reporting && 'btn-disabled loading'), className: clsx(flagClass, reporting && 'btn-disabled loading'),
}} }}
cancelBtn={{
label: 'Cancel',
className: 'border-none btn-sm btn-ghost self-center',
}}
submitBtn={{
label: 'Submit',
className: 'btn-secondary',
}}
onSubmitWithSuccess={onSubmit} onSubmitWithSuccess={onSubmit}
disabled={userReported} disabled={userReported}
> >

View File

@ -1,4 +1,3 @@
import clsx from 'clsx'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import { useState } from 'react' import { useState } from 'react'
import { groupPath } from 'web/lib/firebase/groups' import { groupPath } from 'web/lib/firebase/groups'
@ -87,10 +86,8 @@ export function CreateGroupButton(props: {
}} }}
submitBtn={{ submitBtn={{
label: 'Create', label: 'Create',
className: clsx( color: 'green',
'normal-case', isSubmitting,
isSubmitting ? 'loading btn-disabled' : ' btn-primary'
),
}} }}
onSubmitWithSuccess={onSubmit} onSubmitWithSuccess={onSubmit}
onOpenChanged={(isOpen) => { onOpenChanged={(isOpen) => {

View File

@ -163,7 +163,7 @@ export function GroupSelector(props: {
user={creator} user={creator}
onOpenStateChange={setIsCreatingNewGroup} onOpenStateChange={setIsCreatingNewGroup}
className={ className={
'w-full justify-start rounded-none border-0 bg-white pl-2 font-normal text-gray-900 hover:bg-indigo-500 hover:text-white' 'flex w-full flex-row items-center justify-start rounded-none border-0 bg-white pl-2 font-normal text-gray-900 hover:bg-indigo-500 hover:text-white'
} }
label={'Create a new Group'} label={'Create a new Group'}
addGroupIdParamOnSubmit addGroupIdParamOnSubmit

View File

@ -73,13 +73,6 @@ export function NumericResolutionPanel(props: {
setIsSubmitting(false) setIsSubmitting(false)
} }
const submitButtonClass =
outcomeMode === 'CANCEL'
? 'bg-yellow-400 hover:bg-yellow-500'
: outcome !== undefined
? 'btn-primary'
: 'btn-disabled'
return ( return (
<Col <Col
className={clsx( className={clsx(
@ -129,7 +122,6 @@ export function NumericResolutionPanel(props: {
onResolve={resolve} onResolve={resolve}
isSubmitting={isSubmitting} isSubmitting={isSubmitting}
openModalButtonClass={clsx('w-full mt-2')} openModalButtonClass={clsx('w-full mt-2')}
submitButtonClass={submitButtonClass}
color={outcomeMode === 'CANCEL' ? 'yellow' : 'indigo'} color={outcomeMode === 'CANCEL' ? 'yellow' : 'indigo'}
disabled={outcomeMode === undefined} disabled={outcomeMode === undefined}
/> />

View File

@ -57,11 +57,11 @@ export function WarningConfirmationButton(props: {
}} }}
cancelBtn={{ cancelBtn={{
label: 'Cancel', label: 'Cancel',
className: 'btn btn-warning', color: 'yellow',
}} }}
submitBtn={{ submitBtn={{
label: 'Submit', label: 'Submit',
className: clsx('btn border-none btn-sm btn-ghost self-center'), color: 'gray',
}} }}
onSubmit={onSubmit} onSubmit={onSubmit}
> >

View File

@ -215,7 +215,6 @@ export default function ProfilePage(props: {
}} }}
submitBtn={{ submitBtn={{
label: 'Update key', label: 'Update key',
className: 'btn-primary',
}} }}
onSubmitWithSuccess={async () => { onSubmitWithSuccess={async () => {
updateApiKey() updateApiKey()