From 710762281c85317293fc774f27f2345d582d27fe Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 18 Oct 2021 12:31:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85Layout=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + ...ollPagination.js => BlogPostListScroll.js} | 8 +- components/DrawerRight.js | 4 +- components/SideBar.js | 4 +- components/TopNav.js | 8 +- layouts/ArticleLayout.js | 194 ------------------ .../Container.js => layouts/BaseLayout.js | 30 ++- layouts/IndexLayout.js | 38 ---- layouts/PageLayout.js | 39 ---- pages/404.js | 17 +- pages/article/[slug].js | 175 ++++++++++++++-- pages/index.js | 14 +- pages/page/[page].js | 55 ++--- pages/tag/[tag].js | 12 +- 14 files changed, 246 insertions(+), 353 deletions(-) rename components/{BlogPostListScrollPagination.js => BlogPostListScroll.js} (95%) delete mode 100644 layouts/ArticleLayout.js rename components/Container.js => layouts/BaseLayout.js (63%) delete mode 100644 layouts/IndexLayout.js delete mode 100644 layouts/PageLayout.js diff --git a/README.md b/README.md index 3f1a441c..b5797614 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ ## 页面样式主题 - 仿照 [fukasawa](https://andersnoren.se/themes/fukasawa) +- 仿照 [youtube](https://youtube.com) ## License diff --git a/components/BlogPostListScrollPagination.js b/components/BlogPostListScroll.js similarity index 95% rename from components/BlogPostListScrollPagination.js rename to components/BlogPostListScroll.js index 28369cfe..534e4fab 100644 --- a/components/BlogPostListScrollPagination.js +++ b/components/BlogPostListScroll.js @@ -14,7 +14,7 @@ import BlogPostListEmpty from '@/components/BlogPostListEmpty' * @returns {JSX.Element} * @constructor */ -const BlogPostListScrollPagination = ({ posts = [], tags, targetRef }) => { +const BlogPostListScroll = ({ posts = [], tags }) => { let filteredBlogPosts = posts // 处理查询过滤 支持标签、关键词过滤 @@ -61,10 +61,12 @@ const BlogPostListScrollPagination = ({ posts = [], tags, targetRef }) => { } }) + const targetRef = useRef(null) + if (!postsToShow || postsToShow.length === 0) { return } else { - return
+ return
{/* 文章列表 */}
@@ -100,4 +102,4 @@ const getPostByPage = function (page, totalPosts, postsPerPage) { postsPerPage * page ) } -export default BlogPostListScrollPagination +export default BlogPostListScroll diff --git a/components/DrawerRight.js b/components/DrawerRight.js index a2450cc3..07592e44 100644 --- a/components/DrawerRight.js +++ b/components/DrawerRight.js @@ -26,11 +26,11 @@ const DrawerRight = ({ post, cRef }) => { className={(showDrawer ? 'shadow-2xl' : '-mr-72') + ' overflow-y-auto duration-200 w-72 h-full bg-white dark:bg-gray-700 border-r dark:border-gray-600'}> {/* LOGO */}
-
文章目录 +
文章目录
- +
diff --git a/components/SideBar.js b/components/SideBar.js index 450e0ba8..b0dbf9ca 100644 --- a/components/SideBar.js +++ b/components/SideBar.js @@ -4,11 +4,11 @@ import InfoCard from '@/components/InfoCard' import TagList from '@/components/TagList' const SideBar = ({ tags, currentTag, post }) => { - return