71 lines
2.1 KiB
TypeScript
71 lines
2.1 KiB
TypeScript
"use client";
|
|
|
|
import React from "react";
|
|
import { AlertTriangle, X } from "lucide-react";
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
interface ConfirmDeleteModalProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
onConfirm: () => void;
|
|
title: string;
|
|
message: string;
|
|
itemName?: string;
|
|
}
|
|
|
|
export default function ConfirmDeleteModal({
|
|
isOpen,
|
|
onClose,
|
|
onConfirm,
|
|
title,
|
|
message,
|
|
itemName,
|
|
}: ConfirmDeleteModalProps) {
|
|
if (!isOpen) return null;
|
|
|
|
const handleConfirm = () => {
|
|
onConfirm();
|
|
onClose();
|
|
};
|
|
|
|
return (
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
|
|
<div className="w-full max-w-md rounded-xl bg-white shadow-2xl">
|
|
{/* 헤더 */}
|
|
<div className="flex items-center justify-between rounded-t-xl bg-gradient-to-r from-red-500 to-red-600 px-6 py-4">
|
|
<div className="flex items-center gap-3">
|
|
<AlertTriangle className="h-6 w-6 text-white" />
|
|
<h2 className="text-xl font-bold text-white">{title}</h2>
|
|
</div>
|
|
<button onClick={onClose} className="rounded-lg p-2 text-white transition hover:bg-white/20">
|
|
<X className="h-5 w-5" />
|
|
</button>
|
|
</div>
|
|
|
|
{/* 내용 */}
|
|
<div className="space-y-4 p-6">
|
|
<p className="text-foreground">{message}</p>
|
|
{itemName && (
|
|
<div className="bg-destructive/10 border-destructive/20 rounded-lg border p-3">
|
|
<p className="text-sm font-medium text-red-800">
|
|
삭제 대상: <span className="font-bold">{itemName}</span>
|
|
</p>
|
|
</div>
|
|
)}
|
|
<p className="text-muted-foreground text-sm">이 작업은 되돌릴 수 없습니다. 계속하시겠습니까?</p>
|
|
</div>
|
|
|
|
{/* 버튼 */}
|
|
<div className="flex gap-3 px-6 pb-6">
|
|
<Button onClick={onClose} variant="outline" className="flex-1">
|
|
취소
|
|
</Button>
|
|
<Button onClick={handleConfirm} variant="destructive" className="flex-1">
|
|
삭제
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|