Files
notesnook/apps/mobile/src/components/dialog/functions.ts
ammarahm-ed 6fd462ad13 refactor
2022-02-28 23:25:18 +05:00

35 lines
783 B
TypeScript

import { eSendEvent } from '../../services/event-manager';
import { eCloseSimpleDialog, eOpenSimpleDialog } from '../../utils/events';
type DialogInfo = {
title?: string;
paragraph?: string;
positiveText?: string;
negativeText?: string;
positivePress?: (value: any) => void;
onClose?: () => void;
positiveType?:
| 'transparent'
| 'gray'
| 'grayBg'
| 'accent'
| 'inverted'
| 'shade'
| 'error'
| 'errorShade';
icon?: string;
paragraphColor: string;
input: boolean;
inputPlaceholder: string;
defaultValue: string;
context: 'global' | 'local';
};
export function presentDialog(data: Partial<DialogInfo>): void {
eSendEvent(eOpenSimpleDialog, data);
}
export function hideDialog(): void {
eSendEvent(eCloseSimpleDialog);
}