2022-12-06 17:45:10 +08:00
|
|
|
import React from 'react';
|
2023-02-15 15:05:21 +08:00
|
|
|
import type { MessageInstance, ConfigOptions as MessageConfig } from '../message/interface';
|
|
|
|
import type { NotificationInstance, NotificationConfig } from '../notification/interface';
|
2022-12-06 17:45:10 +08:00
|
|
|
import type { ModalStaticFunctions } from '../modal/confirm';
|
|
|
|
|
2023-02-15 15:05:21 +08:00
|
|
|
export type AppConfig = {
|
|
|
|
message?: MessageConfig;
|
|
|
|
notification?: NotificationConfig;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const AppConfigContext = React.createContext<AppConfig>({});
|
|
|
|
|
2022-12-06 17:45:10 +08:00
|
|
|
type ModalType = Omit<ModalStaticFunctions, 'warn'>;
|
|
|
|
export interface useAppProps {
|
|
|
|
message: MessageInstance;
|
|
|
|
notification: NotificationInstance;
|
|
|
|
modal: ModalType;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|