import { useEffect, useId, useRef } from "react"; import Icon from "./Icon"; export default function Modal({ title, children, onClose, busy = false }) { const dialog = useRef(null); const titleId = useId(); useEffect(() => { const element = dialog.current; element.showModal(); return () => element.close(); }, []); return { event.preventDefault(); if (!busy) onClose(); }}>

{title}

{children}
; }