import { useRef } from 'preact/hooks'; import type { ComponentChildren } from 'preact'; import { useDialog } from '../dialog.ts'; /** A side panel on wide windows and a full-width sheet on narrow ones, over a dimmed page. */ export function Panel({ title, onClose, children }: { title: string; onClose: () => void; children: ComponentChildren }) { const ref = useRef(null); useDialog(ref, onClose, true); return (
{ if (e.target === e.currentTarget) onClose(); }}>
); }