import { createContext, useContext } from 'react'; /** * Close wrapper */ export type CloseWrapper = (close: () => void) => T; /** * Information about a dialog. */ export interface DialogInfo { title?: JSX.Element; description?: JSX.Element; className?: string; buttons?: JSX.Element | CloseWrapper; onClose?: () => void; } /** * Function to show a dialog. */ export type ShowDialogFn = (info: DialogInfo | CloseWrapper) => void; /** * Context for the dialog provider. */ export const DialogContext = createContext(() => {}); /** * @returns The dialog context for showing dialogs. */ export const useDialog = () => useContext(DialogContext);