import { createRef, JSX } from 'preact' import { Button } from '@homeman/components/Button.tsx' import { useEffect } from 'preact/hooks' interface Props extends JSX.HTMLAttributes { headerTitle: string show?: boolean } export function Dialog( { show, headerTitle, children, className, ...props }: Props, ) { const self = createRef() useEffect(() => { if (show) { self.current?.showModal() } else { self.current?.close() } return () => { // cleanup } }, [show]) return (

{headerTitle}

{children}
) }