Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
talha_silentcontent
/
src
/
components
/
Filename :
ConfirmationDialog.tsx
back
Copy
// DynamicAlertDialog.tsx import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { ReactNode } from "react"; interface DynamicAlertDialogProps { title: string; description: string; onConfirm: (key: string) => void; // Modified to accept the key onCancel?: () => void; confirmText?: string; cancelText?: string; triggerButton: ReactNode; keyToDelete: string; // Add this prop } const DynamicAlertDialog: React.FC<DynamicAlertDialogProps> = ({ title, description, onConfirm, onCancel, confirmText = "Continue", cancelText = "Cancel", triggerButton, keyToDelete, // Destructure the keyToDelete prop }) => { const handleConfirm = () => { onConfirm(keyToDelete); // Call onConfirm with the key }; return ( <AlertDialog> <AlertDialogTrigger asChild> {triggerButton} </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>{title}</AlertDialogTitle> <AlertDialogDescription>{description}</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel onClick={onCancel}>{cancelText}</AlertDialogCancel> <AlertDialogAction onClick={handleConfirm}>{confirmText}</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> ); }; export default DynamicAlertDialog;