From f2736cbee2531721068a6acd689f944fa0438518 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 8 Mar 2022 13:18:48 +0800 Subject: [PATCH 1/8] =?UTF-8?q?Hexo=20=E8=8F=9C=E5=8D=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/lang/en-US.js | 1 + lib/lang/zh-CN.js | 1 + themes/Hexo/components/InfoCard.js | 28 ++++++++++++++++++ themes/Hexo/components/MenuButtonGroup.js | 35 +++++++++-------------- themes/Hexo/components/SideRight.js | 29 ++----------------- themes/Hexo/config_hexo.js | 3 +- 6 files changed, 47 insertions(+), 50 deletions(-) create mode 100644 themes/Hexo/components/InfoCard.js diff --git a/lib/lang/en-US.js b/lib/lang/en-US.js index 928e7295..5e02c979 100644 --- a/lib/lang/en-US.js +++ b/lib/lang/en-US.js @@ -24,6 +24,7 @@ export default { AUTHOR: 'Author', URL: 'URL', POSTS: 'Posts', + ARTICLE: 'Article', VISITORS: 'Visitors', VIEWS: 'Views', COPYRIGHT_NOTICE: 'All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!', diff --git a/lib/lang/zh-CN.js b/lib/lang/zh-CN.js index 02e07cf0..915c1a9a 100644 --- a/lib/lang/zh-CN.js +++ b/lib/lang/zh-CN.js @@ -26,6 +26,7 @@ export default { URL: '链接', ANALYTICS: '统计', POSTS: '篇文章', + ARTICLE: '文章', VISITORS: '位访客', VIEWS: '次查看', COPYRIGHT_NOTICE: '本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。', diff --git a/themes/Hexo/components/InfoCard.js b/themes/Hexo/components/InfoCard.js new file mode 100644 index 00000000..28302d0d --- /dev/null +++ b/themes/Hexo/components/InfoCard.js @@ -0,0 +1,28 @@ +import BLOG from '@/blog.config' +import Image from 'next/image' +import { Router } from 'next/router' +import Card from './Card' +import SocialButton from './SocialButton' +import MenuButtonGroup from './MenuButtonGroup' +export function InfoCard (props) { + return +
{ + Router.push('/') + }} + > + {BLOG.AUTHOR} +
+
{BLOG.TITLE}
+ + +
+} diff --git a/themes/Hexo/components/MenuButtonGroup.js b/themes/Hexo/components/MenuButtonGroup.js index cf7af3cd..e0e6946c 100644 --- a/themes/Hexo/components/MenuButtonGroup.js +++ b/themes/Hexo/components/MenuButtonGroup.js @@ -1,37 +1,30 @@ import React from 'react' import Link from 'next/link' -import { useRouter } from 'next/router' import { useGlobal } from '@/lib/global' import CONFIG_HEXO from '../config_hexo' const MenuButtonGroup = (props) => { - const { postCount, customNav } = props + const { postCount, categories, tags } = props const { locale } = useGlobal() - const router = useRouter() - const archiveSlot =
{postCount}
+ const archiveSlot =
{postCount}
+ const categorySlot =
{categories?.length}
+ const tagSlot =
{tags?.length}
- let links = [ - { icon: 'fas fa-home', name: locale.NAV.INDEX, to: '/' || '/', show: true }, - { icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY }, - { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG }, - { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', slot: archiveSlot, show: CONFIG_HEXO.MENU_ARCHIVE }, - { icon: 'fas fa-user', name: locale.NAV.ABOUT, to: '/about', show: CONFIG_HEXO.MENU_ABOUT } + const links = [ + { name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: CONFIG_HEXO.MENU_ARCHIVE }, + { name: locale.COMMON.CATEGORY, to: '/category', slot: categorySlot, show: CONFIG_HEXO.MENU_CATEGORY }, + { name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG_HEXO.MENU_TAG } ] - if (customNav) { - links = links.concat(customNav) - } - return