Show resolve loading indicator
This commit is contained in:
parent
ae4136348d
commit
71975f307c
|
@ -1,5 +1,6 @@
|
||||||
import { MouseEventHandler, ReactNode } from 'react'
|
import { MouseEventHandler, ReactNode } from 'react'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
import { LoadingIndicator } from 'web/components/loading-indicator'
|
||||||
|
|
||||||
export type SizeType = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
|
export type SizeType = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
|
||||||
export type ColorType =
|
export type ColorType =
|
||||||
|
@ -21,6 +22,7 @@ export function Button(props: {
|
||||||
color?: ColorType
|
color?: ColorType
|
||||||
type?: 'button' | 'reset' | 'submit'
|
type?: 'button' | 'reset' | 'submit'
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
loading?: boolean
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
children,
|
children,
|
||||||
|
@ -30,6 +32,7 @@ export function Button(props: {
|
||||||
color = 'indigo',
|
color = 'indigo',
|
||||||
type = 'button',
|
type = 'button',
|
||||||
disabled = false,
|
disabled = false,
|
||||||
|
loading,
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const sizeClasses = {
|
const sizeClasses = {
|
||||||
|
@ -68,9 +71,10 @@ export function Button(props: {
|
||||||
'text-highlight-blue disabled:bg-greyscale-2 border-none shadow-none',
|
'text-highlight-blue disabled:bg-greyscale-2 border-none shadow-none',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
disabled={disabled}
|
disabled={disabled || loading}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
|
{loading && <LoadingIndicator className={'mr-2 border-gray-500'} />}
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,6 +21,7 @@ export function ConfirmationButton(props: {
|
||||||
submitBtn?: {
|
submitBtn?: {
|
||||||
label?: string
|
label?: string
|
||||||
className?: string
|
className?: string
|
||||||
|
isSubmitting?: boolean
|
||||||
}
|
}
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
onSubmit?: () => void
|
onSubmit?: () => void
|
||||||
|
@ -58,7 +59,7 @@ export function ConfirmationButton(props: {
|
||||||
>
|
>
|
||||||
{cancelBtn?.label ?? 'Cancel'}
|
{cancelBtn?.label ?? 'Cancel'}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<Button
|
||||||
className={clsx('btn', submitBtn?.className)}
|
className={clsx('btn', submitBtn?.className)}
|
||||||
onClick={
|
onClick={
|
||||||
onSubmitWithSuccess
|
onSubmitWithSuccess
|
||||||
|
@ -68,9 +69,10 @@ export function ConfirmationButton(props: {
|
||||||
)
|
)
|
||||||
: onSubmit
|
: onSubmit
|
||||||
}
|
}
|
||||||
|
loading={submitBtn?.isSubmitting}
|
||||||
>
|
>
|
||||||
{submitBtn?.label ?? 'Submit'}
|
{submitBtn?.label ?? 'Submit'}
|
||||||
</div>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -125,6 +127,7 @@ export function ResolveConfirmationButton(props: {
|
||||||
submitBtn={{
|
submitBtn={{
|
||||||
label: 'Resolve',
|
label: 'Resolve',
|
||||||
className: clsx('border-none', submitButtonClass),
|
className: clsx('border-none', submitButtonClass),
|
||||||
|
isSubmitting,
|
||||||
}}
|
}}
|
||||||
onSubmit={onResolve}
|
onSubmit={onResolve}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user