Skip to content

Commit

Permalink
🏷️ fix: 修正 antd theme 配置没有导出的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jan 7, 2023
1 parent c4cc329 commit a374437
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/containers/AppContainer/ThemeContent.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<T, S = Record<string, string>>
extends Omit<AntdProviderProps, 'theme'> {
children: ReactNode;
Expand All @@ -23,7 +22,7 @@ export interface ThemeContentProps<T, S = Record<string, string>>
/**
* 直接传入 antd 主题,或者传入一个函数,根据当前的主题模式返回对应的主题
*/
theme?: ThemeConfig | GetAntdTheme;
theme?: ThemeConfig | GetAntdThemeConfig;
}

const ThemeContent: <T, S>(props: ThemeContentProps<T, S>) => ReactElement | null = ({
Expand Down
4 changes: 4 additions & 0 deletions src/types/theme.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ThemeConfig } from 'antd/es/config-provider/context';
import { AliasToken } from 'antd/es/theme/interface';
import { ThemeAppearance, ThemeMode } from './appearance';

Expand Down Expand Up @@ -30,6 +31,9 @@ export type GetCustomStylish<S> = (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 {}

Expand Down

0 comments on commit a374437

Please sign in to comment.