2022-12-06 17:45:10 +08:00
|
|
|
import React from 'react';
|
2023-10-29 14:04:47 +08:00
|
|
|
|
|
|
|
import type { ConfigOptions as MessageConfig, MessageInstance } from '../message/interface';
|
2023-10-21 14:14:37 +08:00
|
|
|
import type { HookAPI as ModalHookAPI } from '../modal/useModal';
|
2023-10-29 14:04:47 +08:00
|
|
|
import type { NotificationConfig, NotificationInstance } from '../notification/interface';
|
2022-12-06 17:45:10 +08:00
|
|
|
|
2023-10-29 14:04:47 +08:00
|
|
|
export interface AppConfig {
|
2023-02-15 15:05:21 +08:00
|
|
|
message?: MessageConfig;
|
|
|
|
notification?: NotificationConfig;
|
2023-10-29 14:04:47 +08:00
|
|
|
}
|
2023-02-15 15:05:21 +08:00
|
|
|
|
|
|
|
export const AppConfigContext = React.createContext<AppConfig>({});
|
|
|
|
|
2022-12-06 17:45:10 +08:00
|
|
|
export interface useAppProps {
|
|
|
|
message: MessageInstance;
|
|
|
|
notification: NotificationInstance;
|
2023-10-21 14:14:37 +08:00
|
|
|
modal: ModalHookAPI;
|
2022-12-06 17:45:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const AppContext = React.createContext<useAppProps>({
|
2022-12-15 11:40:25 +08:00
|
|
|
message: {},
|
|
|
|
notification: {},
|
|
|
|
modal: {},
|
|
|
|
} as useAppProps);
|
2022-12-06 17:45:10 +08:00
|
|
|
|
|
|
|
export default AppContext;
|