mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 23:35:38 +08:00
76241f5d0b
* 做重复了 * Revert "做重复了" This reverts commit 79c59e79ea66c6592df9dca0e41e10399044ec7a. * site(theme): demo block supports no inner margin configuration ref: https://d.umijs.org/guide/write-demo#%E4%B8%8D%E9%9C%80%E8%A6%81%E5%86%85%E8%BE%B9%E8%B7%9D * docs(tabs): update demo styles * chore: update style * test: update snapshot * Revert "site(theme): demo block supports no inner margin configuration" This reverts commitee2ff25796
. * chore: update * Revert "chore: update" This reverts commitbbe449cb3f
. * Revert "Revert "site(theme): demo block supports no inner margin configuration"" This reverts commit5eac19e7f2
. * chore: convert to debug demo * chore: use emotion * test: update snapshot
29 lines
759 B
TypeScript
29 lines
759 B
TypeScript
import React from 'react';
|
|
import type { TabsProps } from 'antd';
|
|
import { Tabs } from 'antd';
|
|
import { Sticky, StickyContainer } from 'react-sticky';
|
|
|
|
const renderTabBar: TabsProps['renderTabBar'] = (props, DefaultTabBar) => (
|
|
<Sticky bottomOffset={80}>
|
|
{({ style }) => <DefaultTabBar {...props} style={{ zIndex: 1, ...style }} />}
|
|
</Sticky>
|
|
);
|
|
|
|
const items = new Array(3).fill(null).map((_, i) => {
|
|
const id = String(i + 1);
|
|
return {
|
|
label: `Tab ${id}`,
|
|
key: id,
|
|
children: `Content of Tab Pane ${id}`,
|
|
style: i === 0 ? { height: 200 } : undefined,
|
|
};
|
|
});
|
|
|
|
const App: React.FC = () => (
|
|
<StickyContainer>
|
|
<Tabs defaultActiveKey="1" renderTabBar={renderTabBar} items={items} />
|
|
</StickyContainer>
|
|
);
|
|
|
|
export default App;
|