Skip to content

Commit

Permalink
优化黑色主题
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Mar 31, 2023
1 parent c5799a8 commit 971b870
Show file tree
Hide file tree
Showing 3 changed files with 911 additions and 566 deletions.
4 changes: 2 additions & 2 deletions packages/provider/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const ConfigProviderContainer: React.FC<{
};

const [token, nativeHashId] = useCacheToken<ProAliasToken>(
tokenContext.theme,
tokenContext.theme as unknown as Theme<any, any>,
[tokenContext.token, finalToken ?? {}],
{
salt,
Expand Down Expand Up @@ -279,7 +279,7 @@ const ConfigProviderContainer: React.FC<{
...proProvideValue!,
valueTypeMap: valueTypeMap || proProvideValue?.valueTypeMap,
token,
theme: tokenContext.theme,
theme: tokenContext.theme as unknown as Theme<any, any>,
hashed: props.hashed,
hashId,
}}
Expand Down
11 changes: 9 additions & 2 deletions packages/provider/src/useStyle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@ export function useStyle(
componentName: string,
styleFn: (token: ProAliasToken) => CSSInterpolation,
) {
const { token = {} as ProAliasToken, hashId = '', theme } = useContext(ProProvider);
let { token = {} as ProAliasToken, hashId = '', theme } = useContext(ProProvider);
const { token: antdToken } = useToken();
const { getPrefixCls } = useContext(AntdConfigProvider.ConfigContext);

token.antCls = `.${getPrefixCls()}`;
token.proComponentsCls = token.proComponentsCls ?? `.${getPrefixCls('pro')}`;

// 如果不在 ProProvider 里面,就用 antd 的
if (!token.layout) {
token = { ...antdToken } as any;
token.proComponentsCls = token.proComponentsCls ?? `.${getPrefixCls('pro')}`;
}

return {
wrapSSR: useStyleRegister(
Expand Down
Loading

0 comments on commit 971b870

Please sign in to comment.