ant-design/components/collapse/demo/_semantic.tsx
Wanpan 730a37f0bd
feat[Collapse]: support classNames and styles (#50557)
* feat[Collapse]: support classNames and styles

* fix: update

* fix: update

* feat[Collapse]: update

* Empty-Commit

* docs: update

* docs: update

* docs: update

* docs: update

* docs: update

---------

Co-authored-by: afc163 <afc163@gmail.com>
2024-08-27 14:07:25 +08:00

51 lines
1.1 KiB
TypeScript

import React from 'react';
import type { CollapseProps } from 'antd';
import { Collapse } from 'antd';
import SemanticPreview from '../../../.dumi/components/SemanticPreview';
import useLocale from '../../../.dumi/hooks/useLocale';
const locales = {
cn: {
header: '头部元素',
body: '内容元素',
},
en: {
header: 'Header element',
body: 'Body element',
},
};
const BlockCollapse: React.FC = (props) => {
const items: CollapseProps['items'] = [
{
key: '1',
label: 'This is panel header',
children: <p>This is panel body</p>,
...props,
},
];
return (
<div style={{ position: 'absolute', inset: 0 }}>
<Collapse {...props} items={items} defaultActiveKey={['1']} />
</div>
);
};
const App: React.FC = () => {
const [locale] = useLocale(locales);
return (
<SemanticPreview
semantics={[
{ name: 'header', desc: locale.header, version: '5.21.0' },
{ name: 'body', desc: locale.body, version: '5.21.0' },
]}
>
<BlockCollapse />
</SemanticPreview>
);
};
export default App;