Skip to content

Commit

Permalink
feat: Use antd ConfigProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed Nov 18, 2022
1 parent f622468 commit 68344ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
14 changes: 0 additions & 14 deletions Assets/js/components/Configure/index.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions Assets/js/components/Document/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { memo, useMemo } from 'react';

import { ConfigProvider } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
import { Meta } from '/js/utils/router';
import useTitle from '/js/hooks/useTitle';
import Configure from '/js/components/Configure';
import { Outlet, useMatches } from 'react-nest-router';

export default memo(function Document(): React.ReactElement {
Expand All @@ -23,8 +23,8 @@ export default memo(function Document(): React.ReactElement {
useTitle(title);

return (
<Configure virtual locale={zhCN}>
<ConfigProvider virtual locale={zhCN}>
<Outlet />
</Configure>
</ConfigProvider>
);
});
7 changes: 3 additions & 4 deletions Assets/js/components/FlexDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React, { memo, useCallback, useRef } from 'react';

import useMedia from '/js/hooks/useMedia';
import { isString } from '/js/utils/utils';
import { Drawer, DrawerProps } from 'antd';
import Configure from '/js/components/Configure';
import { ConfigProvider, Drawer, DrawerProps } from 'antd';

const containerStyle: React.CSSProperties = { position: 'relative' };

Expand Down Expand Up @@ -37,9 +36,9 @@ export default memo(function FlexDrawer({
return (
<Drawer {...restProps} width={isBreakWidth ? breakWidth : width} height={isBreakHeight ? breakHeight : height}>
<div ref={containerRef} style={containerStyle}>
<Configure getPopupContainer={getPopupContainer} getTargetContainer={getTargetContainer}>
<ConfigProvider getPopupContainer={getPopupContainer} getTargetContainer={getTargetContainer}>
{children}
</Configure>
</ConfigProvider>
</div>
</Drawer>
);
Expand Down
7 changes: 3 additions & 4 deletions Assets/js/components/FlexLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import './index.less';

import React, { memo, Suspense, useCallback, useRef, useState } from 'react';

import { Layout } from 'antd';
import useMedia from '/js/hooks/useMedia';
import useStorage from '/js/hooks/useStorage';
import Configure from '/js/components/Configure';
import { ConfigProvider, Layout } from 'antd';
import RouteBreadcrumb from '/js/components/RouteBreadcrumb';
import SuspenseFallBack from '/js/components/SuspenseFallBack';
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
Expand Down Expand Up @@ -135,10 +134,10 @@ export default memo(function FlexLayout(props: FlexLayoutProps): React.ReactElem
</Header>
<Content>
<div ref={contentRef} className={`${prefixUI}-content`}>
<Configure getPopupContainer={getPopupContainer} getTargetContainer={getTargetContainer}>
<ConfigProvider getPopupContainer={getPopupContainer} getTargetContainer={getTargetContainer}>
<RouteBreadcrumb />
<Suspense fallback={<SuspenseFallBack />}>{children}</Suspense>
</Configure>
</ConfigProvider>
</div>
</Content>
</Layout>
Expand Down

0 comments on commit 68344ac

Please sign in to comment.