import clsx from 'clsx' import { ReactNode, useState } from 'react' import { Button, ColorType, SizeType } from './button' import { Col } from './layout/col' import { Modal } from './layout/modal' import { Row } from './layout/row' export function ConfirmationButton(props: { openModalBtn: { label: string icon?: JSX.Element className?: string color?: ColorType size?: SizeType disabled?: boolean } cancelBtn?: { label?: string className?: string } submitBtn?: { label?: string className?: string } children: ReactNode onSubmit?: () => void onOpenChanged?: (isOpen: boolean) => void onSubmitWithSuccess?: () => Promise }) { const { openModalBtn, cancelBtn, submitBtn, onSubmit, children, onOpenChanged, onSubmitWithSuccess, } = props const [open, setOpen] = useState(false) function updateOpen(newOpen: boolean) { onOpenChanged?.(newOpen) setOpen(newOpen) } return ( <> {children}
updateOpen(false)} > {cancelBtn?.label ?? 'Cancel'}
onSubmitWithSuccess().then((success) => updateOpen(!success) ) : onSubmit } > {submitBtn?.label ?? 'Submit'}
) } export function ResolveConfirmationButton(props: { onResolve: () => void isSubmitting: boolean openModalButtonClass?: string submitButtonClass?: string color?: ColorType disabled?: boolean }) { const { onResolve, isSubmitting, openModalButtonClass, submitButtonClass, color, disabled, } = props return (

Are you sure you want to resolve this market?

) }