mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
128 lines
2.3 KiB
TypeScript
128 lines
2.3 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { Button, Descriptions, Radio } from 'antd';
|
|
import type { RadioChangeEvent, DescriptionsProps } from 'antd';
|
|
|
|
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;
|