Skip to content

Commit

Permalink
chore(admin): refine ArticleList
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Mar 8, 2023
1 parent 3e98782 commit d94e57b
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions packages/@vanblog/admin/src/components/ArticleList/index.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
{props.articles.map((article) => {
return (
<a
className="article-list-item uaa"
key={article.id}
href={`/post/${article.id}`}
target={'_blank'}
rel="noreferrer"
>
<div className="">{article.title}</div>
{props.showViewerNum && <div>{`${article.viewer || 0}人次`}</div>}
{props.showRecentViewTime && <div>{getRecentTimeDes(article.lastVisitedTime)}</div>}
</a>
);
})}
</div>
);
}
}) => (
<div>
{articles.map(({ id, title, viewer = 0, lastVisitedTime }) => (
<a
// FIXME: uaa is not a good name
className="article-list-item uaa"
key={id}
href={`/post/${id}`}
target="_blank"
rel="noreferrer"
>
<div className="">{title}</div>
{showViewerNum && <div>{`${viewer || 0}人次`}</div>}
{showRecentViewTime && <div>{getRecentTimeDes(lastVisitedTime)}</div>}
</a>
))}
</div>
);

0 comments on commit d94e57b

Please sign in to comment.