diff --git a/components/Avatar.tsx b/components/Avatar.tsx new file mode 100644 index 0000000..6257a84 --- /dev/null +++ b/components/Avatar.tsx @@ -0,0 +1,12 @@ +import { JSX } from 'preact' + +export function Avatar( + { className, ...props }: JSX.HTMLAttributes, +) { + return ( + + ) +} diff --git a/components/Dialog.tsx b/components/Dialog.tsx new file mode 100644 index 0000000..d7fb690 --- /dev/null +++ b/components/Dialog.tsx @@ -0,0 +1,44 @@ +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} +
+ ) +} diff --git a/components/Label.tsx b/components/Label.tsx index b1b44c4..e65de42 100644 --- a/components/Label.tsx +++ b/components/Label.tsx @@ -4,7 +4,7 @@ export function Label( { children, className, ...props }: JSX.HTMLAttributes, ) { return ( -