2021-12-14 00:47:43 +00:00
|
|
|
import clsx from 'clsx'
|
|
|
|
|
2021-12-15 18:44:34 +00:00
|
|
|
export function ConfirmationButton(props: {
|
2021-12-14 00:47:43 +00:00
|
|
|
id: string
|
|
|
|
openModelBtn: {
|
|
|
|
label: string
|
2022-02-01 20:10:40 +00:00
|
|
|
icon?: any
|
2021-12-14 00:47:43 +00:00
|
|
|
className?: string
|
|
|
|
}
|
|
|
|
cancelBtn?: {
|
|
|
|
label?: string
|
|
|
|
className?: string
|
|
|
|
}
|
|
|
|
submitBtn?: {
|
|
|
|
label?: string
|
|
|
|
className?: string
|
|
|
|
}
|
|
|
|
onSubmit: () => void
|
|
|
|
children: any
|
|
|
|
}) {
|
|
|
|
const { id, openModelBtn, cancelBtn, submitBtn, onSubmit, children } = props
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<label
|
|
|
|
htmlFor={id}
|
|
|
|
className={clsx('btn modal-button', openModelBtn.className)}
|
|
|
|
>
|
2022-02-01 20:10:40 +00:00
|
|
|
{openModelBtn.icon} {openModelBtn.label}
|
2021-12-14 00:47:43 +00:00
|
|
|
</label>
|
|
|
|
<input type="checkbox" id={id} className="modal-toggle" />
|
|
|
|
|
|
|
|
<div className="modal">
|
2022-02-18 00:24:00 +00:00
|
|
|
<div className="modal-box whitespace-normal">
|
2021-12-14 00:47:43 +00:00
|
|
|
{children}
|
|
|
|
|
|
|
|
<div className="modal-action">
|
|
|
|
<label htmlFor={id} className={clsx('btn', cancelBtn?.className)}>
|
|
|
|
{cancelBtn?.label ?? 'Cancel'}
|
|
|
|
</label>
|
|
|
|
<label
|
|
|
|
htmlFor={id}
|
|
|
|
className={clsx('btn', submitBtn?.className)}
|
|
|
|
onClick={onSubmit}
|
|
|
|
>
|
|
|
|
{submitBtn?.label ?? 'Submit'}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
2022-02-17 23:00:19 +00:00
|
|
|
|
|
|
|
export function ResolveConfirmationButton(props: {
|
|
|
|
onResolve: () => void
|
|
|
|
isSubmitting: boolean
|
|
|
|
openModelButtonClass?: string
|
|
|
|
submitButtonClass?: string
|
|
|
|
}) {
|
|
|
|
const { onResolve, isSubmitting, openModelButtonClass, submitButtonClass } =
|
|
|
|
props
|
|
|
|
return (
|
|
|
|
<ConfirmationButton
|
|
|
|
id="resolution-modal"
|
|
|
|
openModelBtn={{
|
|
|
|
className: clsx(
|
|
|
|
'border-none self-start',
|
|
|
|
openModelButtonClass,
|
|
|
|
isSubmitting && 'btn-disabled loading'
|
|
|
|
),
|
|
|
|
label: 'Resolve',
|
|
|
|
}}
|
|
|
|
cancelBtn={{
|
|
|
|
label: 'Back',
|
|
|
|
}}
|
|
|
|
submitBtn={{
|
|
|
|
label: 'Resolve',
|
|
|
|
className: clsx('border-none', submitButtonClass),
|
|
|
|
}}
|
|
|
|
onSubmit={onResolve}
|
|
|
|
>
|
|
|
|
<p>Are you sure you want to resolve this market?</p>
|
|
|
|
</ConfirmationButton>
|
|
|
|
)
|
|
|
|
}
|