diff --git a/components/Drawer.js b/components/Drawer.js
index 155a02f7..1375e7d2 100644
--- a/components/Drawer.js
+++ b/components/Drawer.js
@@ -2,18 +2,18 @@ import Link from 'next/link'
import BLOG from '@/blog.config'
import SearchInput from '@/components/SearchInput'
import MenuButtonGroup from '@/components/MenuButtonGroup'
-import TocBar from '@/components/TocBar'
import React, { useImperativeHandle, useState } from 'react'
import InfoCard from '@/components/InfoCard'
import TagList from '@/components/TagList'
import Logo from '@/components/Logo'
+import LastedPosts from '@/components/LastedPosts'
/**
* 抽屉面板,可以从侧面拉出
* @returns {JSX.Element}
* @constructor
*/
-const Drawer = ({ post, currentTag, cRef, tags }) => {
+const Drawer = ({ post, currentTag, cRef, tags, posts }) => {
// 暴露给父组件 通过cRef.current.handleMenuClick 调用
useImperativeHandle(cRef, () => {
return {
@@ -26,14 +26,13 @@ const Drawer = ({ post, currentTag, cRef, tags }) => {
switchShowDrawer(!showDrawer)
}
return <>
-
+
+ {/* LOGO */}
- {/* LOGO */}
-
+ className={(showDrawer ? '' : '-ml-72') + ' duration-200 w-72 border-r dark:border-gray-600'}>
+
+ className='z-10 py-2 duration-200 mr-2 text-gray-600 text-xl cursor-pointer dark:text-gray-300'>
@@ -42,28 +41,45 @@ const Drawer = ({ post, currentTag, cRef, tags }) => {
{/* 侧边菜单 */}
-
+ className={(showDrawer ? 'shadow-2xl' : '-ml-72') + ' overflow-y-scroll h-screen w-72 duration-200 overflow-y-auto'}>
+
+ {/* 搜索框 */}
-
- {/* 菜单 */}
-
- {tags && (
-
- {/* 标签云 */}
-
+
+ {/* 信息卡 */}
+
+
+
+
+
+
+ {/* 最新文章 */}
+ {posts && (
+
+
)}
+
+ {/* 标签云 */}
+ {tags && (
+
+ )}
+
{/* 背景蒙版 */}
-
>
}
diff --git a/components/LastedPosts.js b/components/LastedPosts.js
new file mode 100644
index 00000000..6b551fa7
--- /dev/null
+++ b/components/LastedPosts.js
@@ -0,0 +1,45 @@
+import Link from 'next/link'
+import BLOG from '@/blog.config'
+import { formatDateFmt } from '@/lib/formatDate'
+import { useRouter } from 'next/router'
+
+/**
+ * 最新文章列表
+ * @param posts
+ * @constructor
+ */
+const LastedPosts = ({ posts }) => {
+ // 按时间排序
+ if (posts) {
+ posts = posts.sort((a, b) => {
+ const dateA = new Date(a?.lastEditedTime || a.createdTime)
+ const dateB = new Date(b?.lastEditedTime || b.createdTime)
+ return dateB - dateA
+ }).slice(0, 5)
+ }
+ const router = useRouter()
+
+ return <>
+
+
+ {posts.map(post => {
+ return (
+
+
+
+ {formatDateFmt(post.lastEditedTime, 'yyyy/MM/dd')}
+
+
+ {post.title}
+
+
+
+ )
+ })}
+
+ >
+}
+export default LastedPosts
diff --git a/components/MenuButtonGroup.js b/components/MenuButtonGroup.js
index d74ad82f..5a756e42 100644
--- a/components/MenuButtonGroup.js
+++ b/components/MenuButtonGroup.js
@@ -24,7 +24,7 @@ const MenuButtonGroup = ({ allowCollapse = false }) => {
link =>
link.show && (
-
+
diff --git a/components/SideBar.js b/components/SideBar.js
index 8838b651..b3a9db30 100644
--- a/components/SideBar.js
+++ b/components/SideBar.js
@@ -2,8 +2,7 @@ import React from 'react'
import MenuButtonGroup from '@/components/MenuButtonGroup'
import InfoCard from '@/components/InfoCard'
import TagList from '@/components/TagList'
-import BLOG from '@/blog.config'
-import Link from 'next/link'
+import LastedPosts from '@/components/LastedPosts'
const SideBar = ({ tags, currentTag, post, posts }) => {
// 按时间排序
@@ -18,35 +17,19 @@ const SideBar = ({ tags, currentTag, post, posts }) => {
return