最新文章组件,按修改时间倒序

This commit is contained in:
tangly1024
2022-04-07 17:00:10 +08:00
parent 7c63f7a5d6
commit cab1c2da68
7 changed files with 44 additions and 49 deletions

View File

@@ -9,8 +9,8 @@ import { useRouter } from 'next/router'
* @param sliceCount 截取展示的数量 默认6
* @constructor
*/
const LatestPostsGroup = ({ posts }) => {
if (!posts) {
const LatestPostsGroup = ({ latestPosts }) => {
if (!latestPosts) {
return <></>
}
// 获取当前路径
@@ -21,11 +21,11 @@ const LatestPostsGroup = ({ posts }) => {
<>
<div className="text-sm pb-1 px-2 flex flex-nowrap justify-between">
<div className="font-light text-gray-600 dark:text-gray-200">
<i className="mr-2 fas fa-archive" />
<i className="mr-2 fas fa-history" />
{locale.COMMON.LATEST_POSTS}
</div>
</div>
{posts.map(post => {
{latestPosts.map(post => {
const selected = currentPath === `${BLOG.SUB_PATH}/article/${post.slug}`
return (
<Link