mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
9f98fc243e
* feat(App): add message & notification options * chore: test * docs: App docs * feat: config inherit in nest app * feat: provide & consume config context internally * docs(App): property literal * fix(App): repect config from props in priority * Update components/app/index.en-US.md * Update components/app/index.zh-CN.md --------- Co-authored-by: MadCcc <1075746765@qq.com>
27 lines
759 B
TypeScript
27 lines
759 B
TypeScript
import React from 'react';
|
|
import type { MessageInstance, ConfigOptions as MessageConfig } from '../message/interface';
|
|
import type { NotificationInstance, NotificationConfig } from '../notification/interface';
|
|
import type { ModalStaticFunctions } from '../modal/confirm';
|
|
|
|
export type AppConfig = {
|
|
message?: MessageConfig;
|
|
notification?: NotificationConfig;
|
|
};
|
|
|
|
export const AppConfigContext = React.createContext<AppConfig>({});
|
|
|
|
type ModalType = Omit<ModalStaticFunctions, 'warn'>;
|
|
export interface useAppProps {
|
|
message: MessageInstance;
|
|
notification: NotificationInstance;
|
|
modal: ModalType;
|
|
}
|
|
|
|
const AppContext = React.createContext<useAppProps>({
|
|
message: {},
|
|
notification: {},
|
|
modal: {},
|
|
} as useAppProps);
|
|
|
|
export default AppContext;
|