2018-06-03 22:00:27 +08:00
|
|
|
---
|
2018-06-28 16:17:22 +08:00
|
|
|
order: 4
|
2018-06-03 22:00:27 +08:00
|
|
|
title:
|
2018-06-22 15:46:21 +08:00
|
|
|
zh-CN: 信息预览抽屉
|
|
|
|
en-US: Preview drawer
|
2018-06-03 22:00:27 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2018-06-26 16:51:51 +08:00
|
|
|
需要快速预览对象概要时使用,点击遮罩区关闭。
|
2018-06-22 15:46:21 +08:00
|
|
|
|
2018-06-03 22:00:27 +08:00
|
|
|
## en-US
|
|
|
|
|
2019-04-19 20:59:45 +08:00
|
|
|
Use Drawer to quickly preview details of an object, such as those in a list.
|
2018-06-03 22:00:27 +08:00
|
|
|
|
|
|
|
```jsx
|
2019-05-07 14:57:32 +08:00
|
|
|
import { Drawer, List, Avatar, Divider, Col, Row } from 'antd';
|
2018-06-03 22:00:27 +08:00
|
|
|
|
2018-08-05 14:28:39 +08:00
|
|
|
const DescriptionItem = ({ title, content }) => (
|
2020-04-28 11:16:01 +08:00
|
|
|
<div className="site-description-item-profile-wrapper">
|
|
|
|
<p className="site-description-item-profile-p-label">{title}:</p>
|
2018-08-05 14:28:39 +08:00
|
|
|
{content}
|
|
|
|
</div>
|
|
|
|
);
|
2018-06-03 22:00:27 +08:00
|
|
|
|
2018-06-28 16:17:22 +08:00
|
|
|
class App extends React.Component {
|
|
|
|
state = { visible: false };
|
2018-07-04 08:29:42 +08:00
|
|
|
|
2018-06-28 16:17:22 +08:00
|
|
|
showDrawer = () => {
|
|
|
|
this.setState({
|
|
|
|
visible: true,
|
|
|
|
});
|
|
|
|
};
|
2018-07-04 08:29:42 +08:00
|
|
|
|
2018-06-28 16:17:22 +08:00
|
|
|
onClose = () => {
|
2018-06-29 11:57:33 +08:00
|
|
|
this.setState({
|
|
|
|
visible: false,
|
|
|
|
});
|
2018-06-28 16:17:22 +08:00
|
|
|
};
|
2018-07-04 08:29:42 +08:00
|
|
|
|
2018-06-03 22:00:27 +08:00
|
|
|
render() {
|
|
|
|
return (
|
2020-05-10 17:15:41 +08:00
|
|
|
<>
|
2018-06-22 15:46:21 +08:00
|
|
|
<List
|
|
|
|
dataSource={[
|
|
|
|
{
|
|
|
|
name: 'Lily',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Lily',
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
bordered
|
|
|
|
renderItem={item => (
|
2019-08-02 18:19:06 +08:00
|
|
|
<List.Item
|
|
|
|
key={item.id}
|
|
|
|
actions={[
|
|
|
|
<a onClick={this.showDrawer} key={`a-${item.id}`}>
|
|
|
|
View Profile
|
|
|
|
</a>,
|
|
|
|
]}
|
|
|
|
>
|
2018-06-22 15:46:21 +08:00
|
|
|
<List.Item.Meta
|
|
|
|
avatar={
|
|
|
|
<Avatar src="https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png" />
|
|
|
|
}
|
2018-06-26 17:17:06 +08:00
|
|
|
title={<a href="https://ant.design/index-cn">{item.name}</a>}
|
2019-11-08 16:25:08 +08:00
|
|
|
description="Progresser XTech"
|
2018-06-22 15:46:21 +08:00
|
|
|
/>
|
|
|
|
</List.Item>
|
|
|
|
)}
|
|
|
|
/>
|
2018-06-03 22:00:27 +08:00
|
|
|
<Drawer
|
|
|
|
width={640}
|
|
|
|
placement="right"
|
|
|
|
closable={false}
|
|
|
|
onClose={this.onClose}
|
|
|
|
visible={this.state.visible}
|
|
|
|
>
|
2020-04-28 11:16:01 +08:00
|
|
|
<p className="site-description-item-profile-p" style={{ marginBottom: 24 }}>
|
2019-12-25 17:43:39 +08:00
|
|
|
User Profile
|
|
|
|
</p>
|
2020-04-28 11:16:01 +08:00
|
|
|
<p className="site-description-item-profile-p">Personal</p>
|
2018-06-03 22:00:27 +08:00
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
2019-10-05 17:35:49 +08:00
|
|
|
<DescriptionItem title="Full Name" content="Lily" />
|
2018-06-03 22:00:27 +08:00
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Account" content="AntDesign@example.com" />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="City" content="HangZhou" />
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Country" content="China🇨🇳" />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Birthday" content="February 2,1900" />
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Website" content="-" />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<DescriptionItem
|
|
|
|
title="Message"
|
|
|
|
content="Make things as simple as possible but no simpler."
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Divider />
|
2020-04-28 11:16:01 +08:00
|
|
|
<p className="site-description-item-profile-p">Company</p>
|
2018-06-03 22:00:27 +08:00
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Position" content="Programmer" />
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Responsibilities" content="Coding" />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
2019-11-08 16:25:08 +08:00
|
|
|
<DescriptionItem title="Department" content="XTech" />
|
2018-06-03 22:00:27 +08:00
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
2018-06-22 15:46:21 +08:00
|
|
|
<DescriptionItem title="Supervisor" content={<a>Lin</a>} />
|
2018-06-03 22:00:27 +08:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<DescriptionItem
|
|
|
|
title="Skills"
|
|
|
|
content="C / C + +, data structures, software engineering, operating systems, computer networks, databases, compiler theory, computer architecture, Microcomputer Principle and Interface Technology, Computer English, Java, ASP, etc."
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Divider />
|
2020-04-28 11:16:01 +08:00
|
|
|
<p className="site-description-item-profile-p">Contacts</p>
|
2018-06-03 22:00:27 +08:00
|
|
|
<Row>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Email" content="AntDesign@example.com" />
|
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<DescriptionItem title="Phone Number" content="+86 181 0000 0000" />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<DescriptionItem
|
|
|
|
title="Github"
|
2019-05-07 14:57:32 +08:00
|
|
|
content={
|
2018-06-03 22:00:27 +08:00
|
|
|
<a href="http://github.com/ant-design/ant-design/">
|
|
|
|
github.com/ant-design/ant-design/
|
|
|
|
</a>
|
2019-05-07 14:57:32 +08:00
|
|
|
}
|
2018-06-03 22:00:27 +08:00
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Drawer>
|
2020-05-10 17:15:41 +08:00
|
|
|
</>
|
2018-06-03 22:00:27 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default App;
|
2018-06-03 22:00:27 +08:00
|
|
|
```
|
2019-12-25 17:43:39 +08:00
|
|
|
|
|
|
|
```css
|
|
|
|
.site-description-item-profile-wrapper {
|
2020-05-10 17:15:41 +08:00
|
|
|
margin-bottom: 7px;
|
2019-12-25 17:43:39 +08:00
|
|
|
color: rgba(0, 0, 0, 0.65);
|
2020-04-28 11:16:01 +08:00
|
|
|
font-size: 14px;
|
|
|
|
line-height: 1.5715;
|
|
|
|
}
|
|
|
|
|
|
|
|
[data-theme='compact'] .site-description-item-profile-wrapper {
|
|
|
|
font-size: 12px;
|
|
|
|
line-height: 1.66667;
|
2019-12-25 17:43:39 +08:00
|
|
|
}
|
2020-04-28 11:16:01 +08:00
|
|
|
|
|
|
|
.ant-drawer-body p.site-description-item-profile-p {
|
2020-05-10 17:15:41 +08:00
|
|
|
display: block;
|
|
|
|
margin-bottom: 16px;
|
2020-04-28 11:16:01 +08:00
|
|
|
color: rgba(0, 0, 0, 0.85);
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 1.5715;
|
|
|
|
}
|
|
|
|
|
|
|
|
[data-theme='compact'] .ant-drawer-body p.site-description-item-profile-p {
|
|
|
|
font-size: 14px;
|
|
|
|
line-height: 1.66667;
|
|
|
|
}
|
|
|
|
|
|
|
|
.site-description-item-profile-p-label {
|
|
|
|
display: inline-block;
|
2020-05-10 17:15:41 +08:00
|
|
|
margin-right: 8px;
|
2019-12-25 17:43:39 +08:00
|
|
|
color: rgba(0, 0, 0, 0.85);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
<style>
|
|
|
|
[data-theme="dark"] .site-description-item-profile-p {
|
|
|
|
color: rgba(255,255,255,0.85);
|
|
|
|
}
|
|
|
|
[data-theme="dark"] .site-description-item-profile-wrapper {
|
|
|
|
color: rgba(255,255,255,0.65);
|
|
|
|
}
|
|
|
|
</style>
|