import { useEffect, useRef, type ReactNode } from "react"; import { Icon } from "./Icon"; interface ConfirmDialogProps { title: string; message: ReactNode; confirmLabel?: string; onConfirm: () => void; onClose: () => void; } export function ConfirmDialog({ title, message, confirmLabel = "Delete", onConfirm, onClose }: ConfirmDialogProps) { const confirmRef = useRef(null); useEffect(() => { confirmRef.current?.focus(); const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") { e.preventDefault(); onClose(); } }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return (
e.stopPropagation()}>

{title}

{message}

); }