diff --git a/components/Analytics.js b/components/Analytics.js new file mode 100644 index 00000000..9677c436 --- /dev/null +++ b/components/Analytics.js @@ -0,0 +1,24 @@ +import { useGlobal } from '@/lib/global' +import { faChartBar } from '@fortawesome/free-solid-svg-icons' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' + +/** + * 统计网站信息 + * @param {*} param0 + * @returns + */ +export default function Analytics ({ postCount }) { + const { locale } = useGlobal() + + return
+
{locale.COMMON.ANALYTICS}
+
+ + {postCount}{locale.COMMON.POSTS} + + | {locale.COMMON.VISITORS} + + | {locale.COMMON.VIEWS} +
+
+} diff --git a/components/BlogPostListScroll.js b/components/BlogPostListScroll.js index b10b70a4..f9cc534a 100644 --- a/components/BlogPostListScroll.js +++ b/components/BlogPostListScroll.js @@ -53,7 +53,7 @@ const BlogPostListScroll = ({ posts = [], tags, currentSearch, currentCategory, if (!postsToShow || postsToShow.length === 0) { return } else { - return
+ return
{/* 文章列表 */}
diff --git a/components/Header.js b/components/Header.js new file mode 100644 index 00000000..bba55268 --- /dev/null +++ b/components/Header.js @@ -0,0 +1,34 @@ +import { faArrowDown } from '@fortawesome/free-solid-svg-icons' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { useEffect, useState } from 'react' +import Typed from 'typed.js' + +/** + * + * @returns 头图 + */ +export default function Header () { + const [typed, changeType] = useState() + useEffect(() => { + if (!typed) { + changeType(new Typed('#typed', { + stringsElement: '#typed-strings', typeSpeed: 200, showCursor: false + })) + } + }) + const scrollToCenter = () => { + document.getElementById('wrapper').scrollIntoView({ behavior: 'smooth' }) + } + return
+
+
+

唐风集里,收卷波澜。

+
+
+
+
+
+
+
+} diff --git a/components/SideAreaLeft.js b/components/SideAreaLeft.js index e1e0fe70..b707897d 100644 --- a/components/SideAreaLeft.js +++ b/components/SideAreaLeft.js @@ -4,10 +4,11 @@ import MenuButtonGroup from '@/components/MenuButtonGroup' import SearchInput from '@/components/SearchInput' import Toc from '@/components/Toc' import { useGlobal } from '@/lib/global' -import { faAngleDoubleRight, faChartBar, faThList } from '@fortawesome/free-solid-svg-icons' +import { faAngleDoubleRight, faThList } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import Link from 'next/link' import React from 'react' +import Analytics from './Analytics' /** * 侧边平铺 @@ -41,17 +42,7 @@ const SideAreaLeft = ({ title, tags, currentTag, post, posts, categories, curren {/* 统计 */} -
-
{locale.COMMON.ANALYTICS}
-
- - {postCount}{locale.COMMON.POSTS} - - | {locale.COMMON.VISITORS} - - | {locale.COMMON.VIEWS} -
-
+ {/* 分类 */} {!post && categories && ( diff --git a/components/SideAreaRight.js b/components/SideAreaRight.js index f8579f1b..5d827e8f 100644 --- a/components/SideAreaRight.js +++ b/components/SideAreaRight.js @@ -10,7 +10,12 @@ import { import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import Link from 'next/link' import React from 'react' +import Analytics from './Analytics' import CategoryGroup from './CategoryGroup' +import InfoCard from './InfoCard' +import MenuButtonGroup from './MenuButtonGroup' +import SearchInput from './SearchInput' +import Toc from './Toc' /** * 侧边平铺 @@ -32,13 +37,29 @@ const SideAreaRight = ({ posts, categories, currentCategory, - currentSearch + currentSearch, + targetRef }) => { const { locale } = useGlobal() + const postCount = posts?.length || 0 + const showToc = post && post.toc && post.toc.length > 1 return ( <> -
+ +
+ +
+ + {/* 菜单 */} +
+ +
+ +
+
+ +
{/* 展示广告 */}
+ +
+ {showToc && ( +
+
+ {locale.COMMON.TABLE_OF_CONTENTS} +
+ +
+ )} + {/* 最新文章 */} {posts && ( -
+
@@ -66,9 +98,13 @@ const SideAreaRight = ({
)} + {/*
+ +
*/} + {/* 标签云 */} {tags && ( -
+
@@ -89,7 +125,7 @@ const SideAreaRight = ({ {/* 分类 */} {post && categories && ( -
+
{locale.COMMON.CATEGORY}
diff --git a/components/TopNav.js b/components/TopNav.js index 1f9c4e42..2db41297 100644 --- a/components/TopNav.js +++ b/components/TopNav.js @@ -9,13 +9,13 @@ const TopNav = ({ tags, currentTag, post, posts, categories, currentCategory }) const drawer = useRef() const { locale } = useGlobal() - return (
+ return (
{/* 侧面抽屉 */} {/* 导航栏 */} -