mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +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,11 +34,14 @@ 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) => {
|
||||
{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}>
|
||||
@ -51,7 +54,8 @@ const ArticleList: React.FC<ArticleListProps> = ({ name, data, authors = [] }) =
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
})
|
||||
)}
|
||||
</ul>
|
||||
</td>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user