mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 23:35:38 +08:00
01ca7c7821
* test: replace testing-lib * test: replace testing-lib * test: replace testing-lib * test: update snap * test: replace testing-lib * test: replace testing-lib * test: update for lint * merge: merge * test: testing-lib * test: replace testing-lib * test: testing-lib * test: testing-lib * test: replace testing-lib * test: replace testing-lib * test: Replace test aria replacment logic * test: Update snapshot * chore: hack for id * test: clean up * test: clean demo * chore: update * test: snapshot update * test: fix snapshot rep logic * test: fix snapshot rep logic * test: fix snapshot rep logic * chore: update demo * test: fix snapshot rep logic * test: Update snapshot * test: rest snapshot * test: update snapshot * test: Update test case * test: config env * chore: clean up * chore: Use renderServer instead * test: adjust testing logic * test: modify test logic * test: split ssr test * test: skip if need skip * chore: ignore test file covv Co-authored-by: 二货机器人 <smith3816@gmail.com>
2.0 KiB
2.0 KiB
order | title | ||||
---|---|---|---|---|---|
1 |
|
zh-CN
配合 List 组件展现评论列表。
en-US
Displaying a series of comments using the antd
List Component.
import { Comment, List, Tooltip } from 'antd';
import moment from 'moment';
import React from 'react';
const data = [
{
actions: [<span key="comment-list-reply-to-0">Reply to</span>],
author: 'Han Solo',
avatar: 'https://joeschmoe.io/api/v1/random',
content: (
<p>
We supply a series of design principles, practical patterns and high quality design
resources (Sketch and Axure), to help people create their product prototypes beautifully and
efficiently.
</p>
),
datetime: (
<Tooltip title={moment('2016-11-22').subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss')}>
<span>{moment('2016-11-22').subtract(1, 'days').fromNow()}</span>
</Tooltip>
),
},
{
actions: [<span key="comment-list-reply-to-0">Reply to</span>],
author: 'Han Solo',
avatar: 'https://joeschmoe.io/api/v1/random',
content: (
<p>
We supply a series of design principles, practical patterns and high quality design
resources (Sketch and Axure), to help people create their product prototypes beautifully and
efficiently.
</p>
),
datetime: (
<Tooltip title={moment('2016-11-22').subtract(2, 'days').format('YYYY-MM-DD HH:mm:ss')}>
<span>{moment('2016-11-22').subtract(2, 'days').fromNow()}</span>
</Tooltip>
),
},
];
const App: React.FC = () => (
<List
className="comment-list"
header={`${data.length} replies`}
itemLayout="horizontal"
dataSource={data}
renderItem={item => (
<li>
<Comment
actions={item.actions}
author={item.author}
avatar={item.avatar}
content={item.content}
datetime={item.datetime}
/>
</li>
)}
/>
);
export default App;