2025-10-01 16:15:53 +09:00
|
|
|
"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">
|
2026-03-09 15:51:42 +09:00
|
|
|
<div className="bg-background rounded-lg shadow-lg border max-w-[95vw] sm:max-w-[500px] w-full">
|
2025-10-01 16:15:53 +09:00
|
|
|
{/* 헤더 */}
|
2026-03-09 15:51:42 +09:00
|
|
|
<div className="flex items-center justify-between px-6 py-4 border-b">
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<AlertTriangle className="w-5 h-5 text-destructive" />
|
|
|
|
|
<h2 className="text-base sm:text-lg font-semibold">{title}</h2>
|
2025-10-01 16:15:53 +09:00
|
|
|
</div>
|
|
|
|
|
<button
|
|
|
|
|
onClick={onClose}
|
2026-03-09 15:51:42 +09:00
|
|
|
className="text-muted-foreground hover:text-foreground rounded-md p-1 transition-colors"
|
2025-10-01 16:15:53 +09:00
|
|
|
>
|
2026-03-09 15:51:42 +09:00
|
|
|
<X className="w-4 h-4" />
|
2025-10-01 16:15:53 +09:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 내용 */}
|
2026-03-09 15:51:42 +09:00
|
|
|
<div className="px-6 py-4 space-y-3">
|
|
|
|
|
<p className="text-sm sm:text-base text-foreground">{message}</p>
|
2025-10-01 16:15:53 +09:00
|
|
|
{itemName && (
|
2026-03-09 15:51:42 +09:00
|
|
|
<div className="bg-destructive/10 border border-destructive/20 rounded-md p-3">
|
|
|
|
|
<p className="text-xs sm:text-sm font-medium text-destructive">
|
2025-10-01 16:15:53 +09:00
|
|
|
삭제 대상: <span className="font-bold">{itemName}</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-03-09 15:51:42 +09:00
|
|
|
<p className="text-xs sm:text-sm text-muted-foreground">
|
2025-10-01 16:15:53 +09:00
|
|
|
이 작업은 되돌릴 수 없습니다. 계속하시겠습니까?
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 버튼 */}
|
2026-03-09 15:51:42 +09:00
|
|
|
<div className="flex gap-2 px-6 pb-6">
|
2025-10-01 16:15:53 +09:00
|
|
|
<Button
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
variant="outline"
|
2026-03-09 15:51:42 +09:00
|
|
|
className="h-8 flex-1 text-xs sm:h-10 sm:text-sm"
|
2025-10-01 16:15:53 +09:00
|
|
|
>
|
|
|
|
|
취소
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handleConfirm}
|
2025-10-02 14:34:15 +09:00
|
|
|
variant="destructive"
|
2026-03-09 15:51:42 +09:00
|
|
|
className="h-8 flex-1 text-xs sm:h-10 sm:text-sm"
|
2025-10-01 16:15:53 +09:00
|
|
|
>
|
|
|
|
|
삭제
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|