diff --git a/src/containers/AppContainer/ThemeContent.tsx b/src/containers/AppContainer/ThemeContent.tsx index 175b8791..268aa673 100644 --- a/src/containers/AppContainer/ThemeContent.tsx +++ b/src/containers/AppContainer/ThemeContent.tsx @@ -1,4 +1,4 @@ -import { GetCustomStylish, GetCustomToken, ThemeAppearance } from '@/types'; +import { GetAntdThemeConfig, GetCustomStylish, GetCustomToken } from '@/types'; import { ReactElement, ReactNode, useMemo } from 'react'; import { useThemeMode } from '@/hooks'; @@ -8,7 +8,6 @@ import { ThemeConfig } from 'antd/es/config-provider/context'; import { ThemeProvider } from '../ThemeProvider'; import { AntdProvider, type AntdProviderProps } from './AntdProvider'; -type GetAntdTheme = (appearance: ThemeAppearance) => ThemeConfig | undefined; export interface ThemeContentProps> extends Omit { children: ReactNode; @@ -23,7 +22,7 @@ export interface ThemeContentProps> /** * 直接传入 antd 主题,或者传入一个函数,根据当前的主题模式返回对应的主题 */ - theme?: ThemeConfig | GetAntdTheme; + theme?: ThemeConfig | GetAntdThemeConfig; } const ThemeContent: (props: ThemeContentProps) => ReactElement | null = ({ diff --git a/src/types/theme.ts b/src/types/theme.ts index dbd52288..afb6150e 100644 --- a/src/types/theme.ts +++ b/src/types/theme.ts @@ -1,3 +1,4 @@ +import { ThemeConfig } from 'antd/es/config-provider/context'; import { AliasToken } from 'antd/es/theme/interface'; import { ThemeAppearance, ThemeMode } from './appearance'; @@ -30,6 +31,9 @@ export type GetCustomStylish = (theme: { appearance: ThemeAppearance; isDarkMode: boolean; }) => S; + +export type GetAntdThemeConfig = (appearance: ThemeAppearance) => ThemeConfig | undefined; + // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface CustomStylish {}