ERP-node/frontend/components/mail/ConfirmDeleteModal.tsx

85 lines
2.4 KiB
TypeScript
Raw Normal View History

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">
<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
{/* 헤더 */}
<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}
className="text-muted-foreground hover:text-foreground rounded-md p-1 transition-colors"
2025-10-01 16:15:53 +09:00
>
<X className="w-4 h-4" />
2025-10-01 16:15:53 +09:00
</button>
</div>
{/* 내용 */}
<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 && (
<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>
)}
<p className="text-xs sm:text-sm text-muted-foreground">
2025-10-01 16:15:53 +09:00
. ?
</p>
</div>
{/* 버튼 */}
<div className="flex gap-2 px-6 pb-6">
2025-10-01 16:15:53 +09:00
<Button
onClick={onClose}
variant="outline"
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}
variant="destructive"
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>
);
}