"use client";
import React from "react";
import {
Dialog,
DialogContent,
DialogHeader,
} from "@/components/ui/resizable-dialog";
import { Button } from "@/components/ui/button";
import { CheckCircle, XCircle, AlertTriangle, Info } from "lucide-react";
export type AlertType = "success" | "error" | "warning" | "info";
interface AlertModalProps {
isOpen: boolean;
onClose: () => void;
type: AlertType;
title: string;
message: string;
confirmText?: string;
onConfirm?: () => void;
}
const alertConfig = {
success: {
icon: CheckCircle,
iconColor: "text-green-500",
titleColor: "text-green-700",
buttonVariant: "default" as const,
},
error: {
icon: XCircle,
iconColor: "text-red-500",
titleColor: "text-red-700",
buttonVariant: "destructive" as const,
},
warning: {
icon: AlertTriangle,
iconColor: "text-yellow-500",
titleColor: "text-yellow-700",
buttonVariant: "default" as const,
},
info: {
icon: Info,
iconColor: "text-blue-500",
titleColor: "text-blue-700",
buttonVariant: "default" as const,
},
};
export function AlertModal({
isOpen,
onClose,
type,
title,
message,
confirmText = "확인",
onConfirm,
}: AlertModalProps) {
const config = alertConfig[type];
const IconComponent = config.icon;
const handleConfirm = () => {
if (onConfirm) {
onConfirm();
}
onClose();
};
return (
);
}
// 편의를 위한 래퍼 함수들
export const SuccessModal = (props: Omit) => ;
export const ErrorModal = (props: Omit) => ;
export const WarningModal = (props: Omit) => ;
export const InfoModal = (props: Omit) => ;