fix story

This commit is contained in:
Benjamin Palko 2025-02-08 20:59:48 -05:00
parent db030556cf
commit 0f3fe04e75

View file

@ -16,15 +16,18 @@
}, },
}, },
}); });
let dialog: HTMLDialogElement | undefined = $state(undefined);
</script> </script>
{#snippet template({ children: _, ...props }: Partial<ComponentProps<typeof Modal>>)} {#snippet template({ children: _, ...props }: Partial<ComponentProps<typeof Modal>>)}
<Modal {...props}> <Button onclick={() => dialog?.showModal()}>Open</Button>
<Modal {...props} backdrop bind:dialog>
<ModalBody> <ModalBody>
<h3 class="text-lg font-bold">Hello!</h3> <h3 class="text-lg font-bold">Hello!</h3>
<p class="py-4">Press ESC key or click the button below to close</p> <p class="py-4">Press ESC key or click the button below to close</p>
<ModalActions> <ModalActions>
<Button>Close</Button> <Button onclick={() => dialog?.close()}>Close</Button>
</ModalActions> </ModalActions>
</ModalBody> </ModalBody>
</Modal> </Modal>