ant-design/components/tabs/demo/card-top.tsx
Wuxh 76241f5d0b
chore(tabs): update demo (#39731)
* 做重复了

* 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 commit ee2ff25796.

* chore: update

* Revert "chore: update"

This reverts commit bbe449cb3f.

* Revert "Revert "site(theme): demo block supports no inner margin configuration""

This reverts commit 5eac19e7f2.

* chore: convert to debug demo

* chore: use emotion

* test: update snapshot
2022-12-23 12:12:24 +08:00

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;