mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-14 16:19:15 +08:00
74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
|
import React, { useState } from 'react';
|
||
|
import type { RadioChangeEvent } from 'antd';
|
||
|
import { Button, ConfigProvider, Descriptions, Radio } from 'antd';
|
||
|
|
||
|
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 (
|
||
|
<ConfigProvider
|
||
|
theme={{
|
||
|
components: {
|
||
|
Descriptions: {
|
||
|
labelBg: 'red',
|
||
|
titleMarginBottom: 2,
|
||
|
itemPaddingBottom: 8,
|
||
|
colonMarginRight: 10,
|
||
|
colonMarginLeft: 20,
|
||
|
extraColor: 'blue',
|
||
|
},
|
||
|
},
|
||
|
}}
|
||
|
>
|
||
|
<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={<div>extra color: blue</div>}>
|
||
|
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
|
||
|
<Descriptions.Item label="Billing">Prepaid</Descriptions.Item>
|
||
|
<Descriptions.Item label="time">18:00:00</Descriptions.Item>
|
||
|
<Descriptions.Item label="Amount">$80.00</Descriptions.Item>
|
||
|
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
|
||
|
<Descriptions.Item label="Official">$60.00</Descriptions.Item>
|
||
|
<Descriptions.Item label="Config Info">
|
||
|
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 />
|
||
|
</Descriptions.Item>
|
||
|
</Descriptions>
|
||
|
<br />
|
||
|
<br />
|
||
|
<Descriptions title="Custom Size" size={size} extra={<Button type="primary">Edit</Button>}>
|
||
|
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
|
||
|
<Descriptions.Item label="Billing">Prepaid</Descriptions.Item>
|
||
|
<Descriptions.Item label="time">18:00:00</Descriptions.Item>
|
||
|
<Descriptions.Item label="Amount">$80.00</Descriptions.Item>
|
||
|
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
|
||
|
<Descriptions.Item label="Official">$60.00</Descriptions.Item>
|
||
|
</Descriptions>
|
||
|
</div>
|
||
|
</ConfigProvider>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|