feat: 去掉antd
This commit is contained in:
19
src/App.tsx
19
src/App.tsx
@@ -10,19 +10,30 @@ import { Redirect } from './modules/Redirect';
|
||||
import { CustomThemeProvider } from '@kevisual/center-components/theme/index.tsx';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
import { ToastContainer } from 'react-toastify';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import 'dayjs/locale/en';
|
||||
import zhCN from 'antd/locale/zh_CN';
|
||||
import enUS from 'antd/locale/en_US';
|
||||
import ConfigProvider from 'antd/es/config-provider';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
const AntProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const theme = useTheme();
|
||||
const primaryColor = theme.palette.primary.main;
|
||||
const secondaryColor = theme.palette.secondary.main;
|
||||
const { i18n } = useTranslation();
|
||||
const [locale, setLocale] = useState(zhCN);
|
||||
useEffect(() => {
|
||||
if (i18n.language === 'en') {
|
||||
setLocale(enUS);
|
||||
} else {
|
||||
setLocale(zhCN);
|
||||
}
|
||||
}, [i18n.language]);
|
||||
return (
|
||||
<ConfigProvider
|
||||
locale={zhCN}
|
||||
locale={locale}
|
||||
theme={{
|
||||
token: {
|
||||
colorPrimary: primaryColor,
|
||||
@@ -43,7 +54,7 @@ const AntProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
},
|
||||
Tooltip: {
|
||||
zIndexPopupBase: 2000,
|
||||
}
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user