chore: correctly close modals and show toast after creating note from shared text

This commit is contained in:
Aman Harwara
2023-07-13 02:16:54 +05:30
parent 8294d0663f
commit 512b8d9fbc
7 changed files with 50 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
import { DialogWithClose } from '@/Utils/CloseOpenModalsAndPopovers'
import { Dialog, DialogStoreProps, useDialogStore } from '@ariakit/react'
import { classNames } from '@standardnotes/snjs'
import { ReactNode } from 'react'
import { ReactNode, useCallback } from 'react'
const AlertDialog = ({
children,
@@ -13,6 +14,15 @@ const AlertDialog = ({
...props,
})
const addCloseMethod = useCallback(
(element: HTMLDivElement | null) => {
if (element) {
;(element as DialogWithClose).close = closeDialog
}
},
[closeDialog],
)
return (
<Dialog
store={dialog}
@@ -21,6 +31,7 @@ const AlertDialog = ({
modal={false}
portal={true}
preventBodyScroll={true}
ref={addCloseMethod}
>
<div
className="absolute z-0 h-full w-full bg-passive-5 opacity-25 md:opacity-75"