A bunch of changes, including moving prompt/confirm out of context

This commit is contained in:
Gregory Schier
2025-01-07 06:56:51 -08:00
parent 4776bbc753
commit 2f7b66fc92
41 changed files with 315 additions and 353 deletions

View File

@@ -12,19 +12,26 @@ export function Dialogs() {
const dialogs = useAtomValue(dialogsAtom);
return (
<>
{dialogs.map(({ render, onClose, id, ...props }: DialogInstance) => (
<Dialog
open
key={id}
onClose={() => {
onClose?.();
hideDialog(id);
}}
{...props}
>
{render({ hide: () => hideDialog(id) })}
</Dialog>
{dialogs.map(({ id, ...props }) => (
<DialogInstance key={id} id={id} {...props} />
))}
</>
);
}
function DialogInstance({ render, onClose, id, ...props }: DialogInstance) {
const children = render({ hide: () => hideDialog(id) });
return (
<Dialog
open
key={id}
onClose={() => {
onClose?.();
hideDialog(id);
}}
{...props}
>
{children}
</Dialog>
);
}