From f26ed55b280a4731ae568fb0d73d3c35da28ef39 Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Sat, 11 Mar 2023 13:49:12 +0800 Subject: [PATCH] chore(admin): refine ArticleList (#235) --- .../src/components/ArticleList/index.tsx | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/packages/admin/src/components/ArticleList/index.tsx b/packages/admin/src/components/ArticleList/index.tsx index 27b963a25..6578bce47 100644 --- a/packages/admin/src/components/ArticleList/index.tsx +++ b/packages/admin/src/components/ArticleList/index.tsx @@ -1,27 +1,30 @@ import { getRecentTimeDes } from '@/services/van-blog/tool'; import './index.css'; -export default function (props: { + +export default ({ + articles, + showViewerNum, + showRecentViewTime, +}: { + // FIXME: Add Article type articles: any[]; showViewerNum: boolean; showRecentViewTime: boolean; -}) { - return ( -
- {props.articles.map((article) => { - return ( - -
{article.title}
- {props.showViewerNum &&
{`${article.viewer || 0}人次`}
} - {props.showRecentViewTime &&
{getRecentTimeDes(article.lastVisitedTime)}
} -
- ); - })} -
- ); -} +}) => ( +
+ {articles.map(({ id, title, viewer = 0, lastVisitedTime }) => ( + +
{title}
+ {showViewerNum &&
{`${viewer || 0}人次`}
} + {showRecentViewTime &&
{getRecentTimeDes(lastVisitedTime)}
} +
+ ))} +
+); \ No newline at end of file