mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-14 16:19:15 +08:00
ecb36840bf
* feat: descriptions implement items api * docs: add jsx debug demo * refactor: add useRow hook * Update components/descriptions/index.tsx Co-authored-by: Wuxh <wxh1220@gmail.com> Signed-off-by: 红果汁 <pingfj77@gmail.com> * Update components/descriptions/index.zh-CN.md Co-authored-by: Wuxh <wxh1220@gmail.com> Signed-off-by: 红果汁 <pingfj77@gmail.com> * Update components/descriptions/index.en-US.md Co-authored-by: Wuxh <wxh1220@gmail.com> Signed-off-by: 红果汁 <pingfj77@gmail.com> * fix: decrease in coverage * refactor: enhancement code --------- Signed-off-by: 红果汁 <pingfj77@gmail.com> Co-authored-by: Wuxh <wxh1220@gmail.com>
129 lines
2.3 KiB
TypeScript
129 lines
2.3 KiB
TypeScript
import type { RadioChangeEvent } from 'antd';
|
|
import { Button, Descriptions, Radio } from 'antd';
|
|
import type { DescriptionsProps } from 'antd/es/descriptions';
|
|
import React, { useState } from 'react';
|
|
|
|
const borderedItems: DescriptionsProps['items'] = [
|
|
{
|
|
key: '1',
|
|
label: 'Product',
|
|
children: 'Cloud Database',
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'Billing',
|
|
children: 'Prepaid',
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'Time',
|
|
children: '18:00:00',
|
|
},
|
|
{
|
|
key: '4',
|
|
label: 'Amount',
|
|
children: '$80.00',
|
|
},
|
|
{
|
|
key: '5',
|
|
label: 'Discount',
|
|
children: '$20.00',
|
|
},
|
|
{
|
|
key: '6',
|
|
label: 'Official',
|
|
children: '$60.00',
|
|
},
|
|
{
|
|
key: '7',
|
|
label: 'Config Info',
|
|
children: (
|
|
<>
|
|
Data disk type: MongoDB
|
|
<br />
|
|
Database version: 3.4
|
|
<br />
|
|
Package: dds.mongo.mid
|
|
<br />
|
|
Storage space: 10 GB
|
|
<br />
|
|
Replication factor: 3
|
|
<br />
|
|
Region: East China 1
|
|
<br />
|
|
</>
|
|
),
|
|
},
|
|
];
|
|
|
|
const items: DescriptionsProps['items'] = [
|
|
{
|
|
key: '1',
|
|
label: 'Product',
|
|
children: 'Cloud Database',
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'Billing',
|
|
children: 'Prepaid',
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'Time',
|
|
children: '18:00:00',
|
|
},
|
|
{
|
|
key: '4',
|
|
label: 'Amount',
|
|
children: '$80.00',
|
|
},
|
|
{
|
|
key: '5',
|
|
label: 'Discount',
|
|
children: '$20.00',
|
|
},
|
|
{
|
|
key: '6',
|
|
label: 'Official',
|
|
children: '$60.00',
|
|
},
|
|
];
|
|
|
|
const App: React.FC = () => {
|
|
const [size, setSize] = useState<'default' | 'middle' | 'small'>('default');
|
|
|
|
const onChange = (e: RadioChangeEvent) => {
|
|
console.log('size checked', e.target.value);
|
|
setSize(e.target.value);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<Radio.Group onChange={onChange} value={size}>
|
|
<Radio value="default">default</Radio>
|
|
<Radio value="middle">middle</Radio>
|
|
<Radio value="small">small</Radio>
|
|
</Radio.Group>
|
|
<br />
|
|
<br />
|
|
<Descriptions
|
|
bordered
|
|
title="Custom Size"
|
|
size={size}
|
|
extra={<Button type="primary">Edit</Button>}
|
|
items={borderedItems}
|
|
/>
|
|
<br />
|
|
<br />
|
|
<Descriptions
|
|
title="Custom Size"
|
|
size={size}
|
|
extra={<Button type="primary">Edit</Button>}
|
|
items={items}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default App;
|