import { isWeb, Dialog, Button, YStack, type ThemeName } from '@junwon/aesthetics' import { useState } from 'react' interface ConfirmDialogProps { onConfirm: () => void | Promise trigger: React.ReactNode title: string description: string confirmText?: string cancelText?: string confirmButtonColor?: ThemeName } export function ConfirmDialog({ onConfirm, trigger, title, description, confirmText = 'Confirm', cancelText = 'Cancel', confirmButtonColor = 'blue', }: ConfirmDialogProps) { const [open, setOpen] = useState(false) const [loading, setLoading] = useState(false) const handleConfirm = async () => { try { setLoading(true) await onConfirm() } finally { setLoading(false) setOpen(false) } } return ( {trigger} {title} {description} ) }