"use client"; import { AlertTriangle, Info, LucideIcon } from "lucide-react"; // ui import { Button, TButtonVariant } from "@plane/ui"; // components import { EModalPosition, EModalWidth, ModalCore } from "@/components/core"; // helpers import { cn } from "@/helpers/common.helper"; export type TModalVariant = "danger" | "primary"; type Props = { content: React.ReactNode | string; handleClose: () => void; handleSubmit: () => Promise; hideIcon?: boolean; isSubmitting: boolean; isOpen: boolean; position?: EModalPosition; primaryButtonText?: { loading: string; default: string; }; secondaryButtonText?: string; title: string; variant?: TModalVariant; width?: EModalWidth; }; const VARIANT_ICONS: Record = { danger: AlertTriangle, primary: Info, }; const BUTTON_VARIANTS: Record = { danger: "danger", primary: "primary", }; const VARIANT_CLASSES: Record = { danger: "bg-red-500/20 text-red-500", primary: "bg-custom-primary-100/20 text-custom-primary-100", }; export const AlertModalCore: React.FC = (props) => { const { content, handleClose, handleSubmit, hideIcon = false, isSubmitting, isOpen, position = EModalPosition.CENTER, primaryButtonText = { loading: "Deleting", default: "Delete", }, secondaryButtonText = "Cancel", title, variant = "danger", width = EModalWidth.XL, } = props; const Icon = VARIANT_ICONS[variant]; return (
{!hideIcon && ( )}

{title}

{content}

); };