mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
refactor dialog to show dialogs impertively
This commit is contained in:
24
apps/mobile/src/components/Dialog/functions.ts
Normal file
24
apps/mobile/src/components/Dialog/functions.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { eSendEvent } from "../../services/EventManager";
|
||||
import { eCloseSimpleDialog, eOpenSimpleDialog } from "../../utils/Events";
|
||||
|
||||
type DialogInfo = {
|
||||
title?: string,
|
||||
paragraph?: string,
|
||||
positiveText?: string,
|
||||
negativeText?: string,
|
||||
positivePress?: () => void,
|
||||
onClose?: () => void,
|
||||
positiveType?: "transparent" | "gray" | "grayBg" | "accent" | "inverted" | "shade" | "error" | "errorShade",
|
||||
icon?: string,
|
||||
paragraphColor: string
|
||||
}
|
||||
|
||||
export function presentDialog(data: DialogInfo): void {
|
||||
eSendEvent(eOpenSimpleDialog, data);
|
||||
}
|
||||
|
||||
export function hideDialog(): void {
|
||||
|
||||
eSendEvent(eCloseSimpleDialog);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user