Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 legacyLogicalPropertiesTransformer ProLayout aside组件submenu样式显示出现问题 #92

Open
wangs1203 opened this issue Feb 28, 2023 · 0 comments

Comments

@wangs1203
Copy link

packages:
"@ant-design/cssinjs": "^1.5.6",
"@ant-design/pro-components": "^2.3.57",
"antd": "^5.2.2",

image

image

use:

import { ConfigProvider, theme } from 'antd';
import { legacyLogicalPropertiesTransformer, StyleProvider } from '@ant-design/cssinjs';
import zhCN from 'antd/locale/zh_CN';
import enUS from 'antd/locale/en_US';
import { PRIMARY_ACTIVE_COLOR, PRIMARY_COLOR } from '@/constants/color';

const ANTDLocaleMap = {
  'zh-CN': zhCN,
  'en-US': enUS,
};

export default function AntdConfigProvider({
  language,
  children,
}: {
  language: string;
  children: React.ReactElement;
}) {
  return (
    <ConfigProvider
      theme={{
        token: {
          colorPrimary: PRIMARY_COLOR,
          colorLink: PRIMARY_COLOR,
          colorLinkHover: PRIMARY_ACTIVE_COLOR,
          colorLinkActive: PRIMARY_ACTIVE_COLOR,
          colorBgLayout: '#fff',
        },
        components: {
          Layout: {
            colorBgHeader: 'linear-gradient(180deg, #248668, #11604D)',
            colorText: '#fff',
            controlHeight: 60,
          },
          Tree: {
            colorText: PRIMARY_COLOR,
          },
        },
        algorithm: theme.defaultAlgorithm,
      }}
      locale={ANTDLocaleMap[language]}
      componentSize="middle"
      virtual
    >
      <StyleProvider transformers={[legacyLogicalPropertiesTransformer]}>{children}</StyleProvider>
    </ConfigProvider>
  );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant