Skip to content

Commit

Permalink
🔥 feat: 通过实际使用测试,移除 AppContainer 上的 globalStyle props
Browse files Browse the repository at this point in the history
BREAKING CHANGE: 移除 AppContainer 的 globalStyle props
  • Loading branch information
arvinxx committed Jan 7, 2023
1 parent cdb6fb8 commit 1d3ee08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 36 deletions.
35 changes: 15 additions & 20 deletions src/containers/AppContainer/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import { DisplayTheme, ThemeMode } from '@/types';
import { ThemeModeContext } from '@/context';
import { ThemeProvider, ThemeProviderProps } from '../ThemeProvider';
import { AntdProvider, type AntdProviderProps } from './AntdProvider';
import { GlobalStyle, GlobalStyleProps } from './GloabalStyle';

export interface AppContainerProps<T, S = Record<string, string>>
extends ThemeProviderProps<T, S>,
AntdProviderProps,
GlobalStyleProps {
AntdProviderProps {
/**
* 应用的展示外观主题,只存在亮色和暗色两种
* @default light
Expand All @@ -32,21 +30,18 @@ export interface AppContainerProps<T, S = Record<string, string>>
}

export const AppContainer: <T, S>(props: AppContainerProps<T, S>) => ReactElement | null = memo(
({ children, appearance, themeMode, customToken, customStylish, globalStyle, ...props }) => {
return (
<ThemeModeContext.Provider
value={{
themeMode: themeMode || 'light',
appearance: appearance || 'light',
}}
>
<AntdProvider {...props}>
<ThemeProvider customToken={customToken} customStylish={customStylish}>
<GlobalStyle globalStyle={globalStyle} />
{children}
</ThemeProvider>
</AntdProvider>
</ThemeModeContext.Provider>
);
},
({ children, appearance, themeMode, customToken, customStylish, ...props }) => (
<ThemeModeContext.Provider
value={{
themeMode: themeMode || 'light',
appearance: appearance || 'light',
}}
>
<AntdProvider {...props}>
<ThemeProvider customToken={customToken} customStylish={customStylish}>
{children}
</ThemeProvider>
</AntdProvider>
</ThemeModeContext.Provider>
),
);
16 changes: 0 additions & 16 deletions src/containers/AppContainer/GloabalStyle.tsx

This file was deleted.

0 comments on commit 1d3ee08

Please sign in to comment.