mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-02 15:59: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
66 lines
1.3 KiB
TypeScript
66 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { Tabs, theme } from 'antd';
|
|
import { css } from '@emotion/css';
|
|
|
|
const useStyle = () => {
|
|
const { token } = theme.useToken();
|
|
const antdTabsCls = '.ant-tabs';
|
|
|
|
return css`
|
|
background: ${token.colorBgLayout};
|
|
padding: ${token.paddingLG}px;
|
|
|
|
${antdTabsCls}${antdTabsCls}-card {
|
|
${antdTabsCls}-content {
|
|
padding: ${token.padding}px;
|
|
background: ${token.colorBgContainer};
|
|
}
|
|
|
|
${antdTabsCls}-nav {
|
|
margin: 0;
|
|
|
|
${antdTabsCls}-nav-wrap > ${antdTabsCls}-nav-list > ${antdTabsCls}-tab {
|
|
background: transparent;
|
|
border-color: transparent;
|
|
|
|
&-active {
|
|
border-color: ${token.colorBorderBg};
|
|
background: ${token.colorBgContainer};
|
|
}
|
|
}
|
|
|
|
&::before {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
};
|
|
|
|
const items = new Array(3).fill(null).map((_, i) => {
|
|
const id = String(i + 1);
|
|
return {
|
|
label: `Tab Title ${id}`,
|
|
key: id,
|
|
children: (
|
|
<>
|
|
<p>Content of Tab Pane {id}</p>
|
|
<p>Content of Tab Pane {id}</p>
|
|
<p>Content of Tab Pane {id}</p>
|
|
</>
|
|
),
|
|
};
|
|
});
|
|
|
|
const App = () => {
|
|
const style = useStyle();
|
|
|
|
return (
|
|
<div className={style}>
|
|
<Tabs type="card" items={items} />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default App;
|