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 * as React from 'react';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { FormattedMessage, useIntl } from 'react-intl';
|
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 { useSiteData } from '../../Home/util';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
@ -34,24 +34,28 @@ interface ArticleListProps {
|
|||||||
authors: Authors;
|
authors: Authors;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ArticleList: React.FC<ArticleListProps> = ({ name, data, authors = [] }) => (
|
const ArticleList: React.FC<ArticleListProps> = ({ name, data = [], authors = [] }) => (
|
||||||
<td>
|
<td>
|
||||||
<h4>{name}</h4>
|
<h4>{name}</h4>
|
||||||
<ul className="article-list">
|
<ul className="article-list">
|
||||||
{data.map((article, index) => {
|
{data.length === 0 ? (
|
||||||
const author = authors.find(auth => auth.name === article.author);
|
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||||
return (
|
) : (
|
||||||
<li key={index}>
|
data.map((article, index) => {
|
||||||
<a href={author?.href} target="_blank" rel="noreferrer">
|
const author = authors.find(auth => auth.name === article.author);
|
||||||
<Avatar size="small" src={author?.avatar} />
|
return (
|
||||||
</a>
|
<li key={index}>
|
||||||
<Divider type="vertical" />
|
<a href={author?.href} target="_blank" rel="noreferrer">
|
||||||
<a href={article.href} target="_blank" rel="noreferrer">
|
<Avatar size="small" src={author?.avatar} />
|
||||||
{article.title}
|
</a>
|
||||||
</a>
|
<Divider type="vertical" />
|
||||||
</li>
|
<a href={article.href} target="_blank" rel="noreferrer">
|
||||||
);
|
{article.title}
|
||||||
})}
|
</a>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user