2022-11-09 12:28:04 +08:00
|
|
|
import React from 'react';
|
2023-07-28 16:17:43 +08:00
|
|
|
import { Tabs } from 'antd';
|
2024-04-08 14:04:08 +08:00
|
|
|
import { createStyles } from 'antd-style';
|
2022-12-23 12:12:24 +08:00
|
|
|
|
2023-07-21 17:14:54 +08:00
|
|
|
const useStyle = createStyles(({ token, css }) => {
|
2022-12-23 12:12:24 +08:00
|
|
|
const antdTabsCls = '.ant-tabs';
|
|
|
|
|
|
|
|
return css`
|
|
|
|
${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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2023-07-21 17:14:54 +08:00
|
|
|
});
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
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>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-12-23 12:12:24 +08:00
|
|
|
const App = () => {
|
2023-07-21 17:14:54 +08:00
|
|
|
const { styles } = useStyle();
|
2022-12-23 12:12:24 +08:00
|
|
|
|
|
|
|
return (
|
2023-07-21 17:14:54 +08:00
|
|
|
<div className={styles}>
|
2022-12-23 12:12:24 +08:00
|
|
|
<Tabs type="card" items={items} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
|
|
export default App;
|