85 lines
2.3 KiB
TypeScript
85 lines
2.3 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="bg-white rounded-xl shadow-2xl max-w-md w-full">
|
|
{/* 헤더 */}
|
|
<div className="bg-gradient-to-r from-red-500 to-red-600 px-6 py-4 flex items-center justify-between rounded-t-xl">
|
|
<div className="flex items-center gap-3">
|
|
<AlertTriangle className="w-6 h-6 text-white" />
|
|
<h2 className="text-xl font-bold text-white">{title}</h2>
|
|
</div>
|
|
<button
|
|
onClick={onClose}
|
|
className="text-white hover:bg-white/20 rounded-lg p-2 transition"
|
|
>
|
|
<X className="w-5 h-5" />
|
|
</button>
|
|
</div>
|
|
|
|
{/* 내용 */}
|
|
<div className="p-6 space-y-4">
|
|
<p className="text-foreground">{message}</p>
|
|
{itemName && (
|
|
<div className="bg-destructive/10 border border-destructive/20 rounded-lg p-3">
|
|
<p className="text-sm font-medium text-red-800">
|
|
삭제 대상: <span className="font-bold">{itemName}</span>
|
|
</p>
|
|
</div>
|
|
)}
|
|
<p className="text-sm text-muted-foreground">
|
|
이 작업은 되돌릴 수 없습니다. 계속하시겠습니까?
|
|
</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>
|
|
);
|
|
}
|
|
|