mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 15:39:45 +08:00
docs: fix articles empty bug
This commit is contained in:
parent
34d7a1c80c
commit
c5dfd61cf5
@ -2,7 +2,7 @@
|
||||
import * as React from 'react';
|
||||
import moment from 'moment';
|
||||
import { FormattedMessage, useIntl } from 'react-intl';
|
||||
import { Tabs, Skeleton, Avatar, Divider } from 'antd';
|
||||
import { Tabs, Skeleton, Avatar, Divider, Empty } from 'antd';
|
||||
import { useSiteData } from '../../Home/util';
|
||||
import './index.less';
|
||||
|
||||
@ -34,24 +34,28 @@ interface ArticleListProps {
|
||||
authors: Authors;
|
||||
}
|
||||
|
||||
const ArticleList: React.FC<ArticleListProps> = ({ name, data, authors = [] }) => (
|
||||
const ArticleList: React.FC<ArticleListProps> = ({ name, data = [], authors = [] }) => (
|
||||
<td>
|
||||
<h4>{name}</h4>
|
||||
<ul className="article-list">
|
||||
{data.map((article, index) => {
|
||||
const author = authors.find(auth => auth.name === article.author);
|
||||
return (
|
||||
<li key={index}>
|
||||
<a href={author?.href} target="_blank" rel="noreferrer">
|
||||
<Avatar size="small" src={author?.avatar} />
|
||||
</a>
|
||||
<Divider type="vertical" />
|
||||
<a href={article.href} target="_blank" rel="noreferrer">
|
||||
{article.title}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
{data.length === 0 ? (
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
) : (
|
||||
data.map((article, index) => {
|
||||
const author = authors.find(auth => auth.name === article.author);
|
||||
return (
|
||||
<li key={index}>
|
||||
<a href={author?.href} target="_blank" rel="noreferrer">
|
||||
<Avatar size="small" src={author?.avatar} />
|
||||
</a>
|
||||
<Divider type="vertical" />
|
||||
<a href={article.href} target="_blank" rel="noreferrer">
|
||||
{article.title}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</ul>
|
||||
</td>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user