From 977f4da9dfa816b0ce47d0d0fce340dfa4c4ccb5 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Wed, 4 Jan 2023 10:57:03 +0800 Subject: [PATCH] demo: update demo code (#39982) * type: add Tab type * add notes * update demo code --- .dumi/loading.js | 1 + components/tabs/demo/basic.tsx | 43 ++++++++++++++++------------------ components/tabs/index.tsx | 1 - 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.dumi/loading.js b/.dumi/loading.js index efaadee1be..23b84ea095 100644 --- a/.dumi/loading.js +++ b/.dumi/loading.js @@ -1,2 +1,3 @@ +// must be .js file, can't modify to be .ts file! // eslint-disable-next-line no-restricted-exports export { default } from './theme/common/Loading'; diff --git a/components/tabs/demo/basic.tsx b/components/tabs/demo/basic.tsx index e633254be3..2b954ec312 100644 --- a/components/tabs/demo/basic.tsx +++ b/components/tabs/demo/basic.tsx @@ -1,32 +1,29 @@ import React from 'react'; import { Tabs } from 'antd'; +import type { TabsProps } from 'antd'; const onChange = (key: string) => { console.log(key); }; -const App: React.FC = () => ( - -); +const items: TabsProps['items'] = [ + { + key: '1', + label: `Tab 1`, + children: `Content of Tab Pane 1`, + }, + { + key: '2', + label: `Tab 2`, + children: `Content of Tab Pane 2`, + }, + { + key: '3', + label: `Tab 3`, + children: `Content of Tab Pane 3`, + }, +]; + +const App: React.FC = () => ; export default App; diff --git a/components/tabs/index.tsx b/components/tabs/index.tsx index 84f7a993ec..9e1b375f02 100755 --- a/components/tabs/index.tsx +++ b/components/tabs/index.tsx @@ -6,7 +6,6 @@ import type { TabsProps as RcTabsProps } from 'rc-tabs'; import RcTabs from 'rc-tabs'; import type { EditableConfig } from 'rc-tabs/lib/interface'; import * as React from 'react'; - import { ConfigContext } from '../config-provider'; import type { SizeType } from '../config-provider/SizeContext'; import SizeContext from '../config-provider/SizeContext';