58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
"use client";
|
||
|
||
import { useEffect, useState } from "react";
|
||
import { Button } from "@/components/ui/button";
|
||
import {
|
||
Dialog,
|
||
DialogContent,
|
||
DialogDescription,
|
||
DialogFooter,
|
||
DialogHeader,
|
||
DialogTitle,
|
||
} from "@/components/ui/dialog";
|
||
|
||
interface AlertModalProps {
|
||
isOpen: boolean;
|
||
onClose: () => void;
|
||
onConfirm: () => void;
|
||
loading: boolean;
|
||
}
|
||
|
||
export const AlertModal: React.FC<AlertModalProps> = ({
|
||
isOpen,
|
||
onClose,
|
||
onConfirm,
|
||
loading,
|
||
}) => {
|
||
const [isMounted, setIsMounted] = useState(false);
|
||
|
||
useEffect(() => {
|
||
setIsMounted(true);
|
||
}, []);
|
||
|
||
if (!isMounted) {
|
||
return null;
|
||
}
|
||
|
||
return (
|
||
<Dialog open={isOpen} onOpenChange={onClose}>
|
||
<DialogContent>
|
||
<DialogHeader>
|
||
<DialogTitle>Emin misiniz?</DialogTitle>
|
||
<DialogDescription>
|
||
Bu işlem geri alınamaz. Bu kategoriyi kalıcı olarak silmek istediğinizden emin misiniz?
|
||
</DialogDescription>
|
||
</DialogHeader>
|
||
<DialogFooter className="pt-6 space-x-2 flex items-center justify-end w-full">
|
||
<Button disabled={loading} variant="outline" onClick={onClose}>
|
||
İptal
|
||
</Button>
|
||
<Button disabled={loading} variant="destructive" onClick={onConfirm}>
|
||
Devam Et
|
||
</Button>
|
||
</DialogFooter>
|
||
</DialogContent>
|
||
</Dialog>
|
||
);
|
||
};
|