import React from 'react'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertDialogDescription, } from './ui/alert-dialog'; import { useTranslation } from '@i18next-toolkit/react'; import { Button } from './ui/button'; interface AlertConfirmProps extends React.PropsWithChildren { title?: string; description?: string; content?: React.ReactNode; onCancel?: () => void; onConfirm?: () => void | Promise; } export const AlertConfirm: React.FC = React.memo((props) => { const { t } = useTranslation(); return ( {props.children} {props.title ?? t('Confirm action')} {props.description && ( {props.description} )}
{props.content ?? t('Are you sure you want to do this?')}
{t('Cancel')} {t('Confirm')}
); }); AlertConfirm.displayName = 'AlertConfirm';