From 2586a2831706aca5804a822aa0ce289800d32749 Mon Sep 17 00:00:00 2001 From: fighting-bug Date: Wed, 15 Mar 2023 13:24:19 +0800 Subject: [PATCH 1/8] =?UTF-8?q?hexo=E4=B8=BB=E9=A2=98=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E4=B8=AA=E9=A6=96=E9=A1=B5=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hexo主题增加了个首页按钮 --- themes/hexo/components/MenuButtonGroupTop.js | 1 + themes/hexo/config_hexo.js | 1 + 2 files changed, 2 insertions(+) diff --git a/themes/hexo/components/MenuButtonGroupTop.js b/themes/hexo/components/MenuButtonGroupTop.js index f6ae7a29..90efcaf7 100644 --- a/themes/hexo/components/MenuButtonGroupTop.js +++ b/themes/hexo/components/MenuButtonGroupTop.js @@ -8,6 +8,7 @@ const MenuButtonGroupTop = (props) => { const { locale } = useGlobal() let links = [ + { icon: 'fa-solid fa-house', name: locale.NAV.INDEX, to: '/', show: CONFIG_HEXO.MENU_INDEX }, { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_HEXO.MENU_SEARCH }, { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_HEXO.MENU_ARCHIVE } // { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY }, diff --git a/themes/hexo/config_hexo.js b/themes/hexo/config_hexo.js index 3a2612fd..73febab2 100644 --- a/themes/hexo/config_hexo.js +++ b/themes/hexo/config_hexo.js @@ -6,6 +6,7 @@ const CONFIG_HEXO = { HOME_NAV_BACKGROUND_IMG_FIXED: true, // 首页背景图滚动时是否固定,true 则滚动时图片不懂; false则随鼠标滚动 // 菜单配置 + MENU_INDEX: true, // 显示首页 MENU_CATEGORY: true, // 显示分类 MENU_TAG: true, // 显示标签 MENU_ARCHIVE: true, // 显示归档 From fafcfbed40b9ca7b11c392d543cf84e8d267177e Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 15 Mar 2023 16:11:42 +0800 Subject: [PATCH 2/8] :-) --- themes/hexo/components/MenuButtonGroupTop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/hexo/components/MenuButtonGroupTop.js b/themes/hexo/components/MenuButtonGroupTop.js index 90efcaf7..866898e8 100644 --- a/themes/hexo/components/MenuButtonGroupTop.js +++ b/themes/hexo/components/MenuButtonGroupTop.js @@ -37,12 +37,12 @@ const MenuButtonGroupTop = (props) => { - ); + ) } else { return null } })} - ); + ) } export default MenuButtonGroupTop From 7f6331e8eb976dd3519827ae9587639beb175b9d Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 15 Mar 2023 16:11:48 +0800 Subject: [PATCH 3/8] contributor --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44220cd3..87a96423 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,9 @@ SkysCrystal
Simon Shi

🔧 🐛 S.Y. Lee
S.Y. Lee

🔧 🐛 - - + + fighting-buf
fighting-buf

🔧 🐛 + From 5bb91255c23f43d9643527f4f2e2690aa435a19a Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 15 Mar 2023 16:45:38 +0800 Subject: [PATCH 4/8] =?UTF-8?q?matery=20=E4=B8=BB=E9=A2=98=E5=BE=AE?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/matery/components/BlogPostCard.js | 18 ++++-------------- themes/matery/components/BlogPostListPage.js | 4 ++-- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/themes/matery/components/BlogPostCard.js b/themes/matery/components/BlogPostCard.js index 980141eb..b3941fdc 100644 --- a/themes/matery/components/BlogPostCard.js +++ b/themes/matery/components/BlogPostCard.js @@ -20,10 +20,10 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { data-aos-delay={delay} data-aos-once="true" data-aos-anchor-placement="top-bottom" - className="w-full mb-4 h-full overflow-auto shadow-md border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray"> + className="w-full mb-4 overflow-auto shadow-md border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray"> {/* 固定高度 ,空白用图片拉升填充 */} -
+
{/* 头部图片 填充卡片 */} {showPageCover && ( @@ -36,22 +36,12 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { alt={post.title} className="opacity-50 h-full w-full hover:scale-125 rounded-t-md transform object-cover duration-500" /> - {/*
- {post.title} -
*/} - {post.title} + {post.title}
)} + {/* 文字描述 */}
{/* 描述 */}
diff --git a/themes/matery/components/BlogPostListPage.js b/themes/matery/components/BlogPostListPage.js index 2b716581..4a041aa7 100644 --- a/themes/matery/components/BlogPostListPage.js +++ b/themes/matery/components/BlogPostListPage.js @@ -21,9 +21,9 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => {
{/* 文章列表 */} -
+
{posts.map(post => ( - +
))}
{showPagination && } From f78745dcbdf77df809fcb21d9e70a72ae8450ef6 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 15 Mar 2023 17:44:32 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fukasawa=E4=B8=BB=E9=A2=98=E5=BE=AE?= =?UTF-8?q?=E8=B0=83=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/theme-fukasawa.css | 29 ++++++++ themes/fukasawa/LayoutBase.js | 6 ++ themes/fukasawa/components/BlogCard.js | 72 +++++++++---------- themes/fukasawa/components/BlogListPage.js | 26 +------ themes/fukasawa/components/BlogListScroll.js | 25 ++----- themes/fukasawa/components/Card.js | 7 +- .../matery/components/BlogPostListScroll.js | 6 +- 7 files changed, 83 insertions(+), 88 deletions(-) create mode 100644 public/css/theme-fukasawa.css diff --git a/public/css/theme-fukasawa.css b/public/css/theme-fukasawa.css new file mode 100644 index 00000000..5a62c5d9 --- /dev/null +++ b/public/css/theme-fukasawa.css @@ -0,0 +1,29 @@ +#theme-fukasawa .grid-item { + height: auto; + break-inside: avoid-column; + margin-bottom: .5rem; + } + + /* 大屏幕(宽度≥1024px)下显示3列 */ + @media (min-width: 1024px) { + #theme-fukasawa .grid-container { + column-count: 3; + column-gap: .5rem; + } + } + + /* 小屏幕(宽度≥640px)下显示2列 */ + @media (min-width: 640px) and (max-width: 1023px) { + #theme-fukasawa .grid-container { + column-count: 2; + column-gap: .5rem; + } + } + + /* 移动端(宽度<640px)下显示1列 */ + @media (max-width: 639px) { + #theme-fukasawa .grid-container { + column-count: 1; + column-gap: .5rem; + } + } \ No newline at end of file diff --git a/themes/fukasawa/LayoutBase.js b/themes/fukasawa/LayoutBase.js index b54fcae6..6cb6de67 100644 --- a/themes/fukasawa/LayoutBase.js +++ b/themes/fukasawa/LayoutBase.js @@ -3,6 +3,7 @@ import TopNav from './components/TopNav' import AsideLeft from './components/AsideLeft' import Live2D from '@/components/Live2D' import BLOG from '@/blog.config' +import { isBrowser, loadExternalResource } from '@/lib/utils' /** * 基础布局 采用左右两侧布局,移动端使用顶部导航栏 @@ -25,6 +26,11 @@ const LayoutBase = (props) => { meta } = props const leftAreaSlot = + + if (isBrowser()) { + loadExternalResource('/css/theme-fukasawa.css', 'css') + } + return (
diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js index 9882ee94..1d382cf7 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -2,9 +2,8 @@ import BLOG from '@/blog.config' import Link from 'next/link' import React from 'react' import CONFIG_FUKA from '../config_fuka' -import Card from './Card' -const BlogCard = ({ post, showSummary, siteInfo }) => { +const BlogCard = ({ index, post, showSummary, siteInfo }) => { const showPreview = CONFIG_FUKA.POST_LIST_PREVIEW && post.blockMap // matery 主题默认强制显示图片 if (post && !post.page_cover) { @@ -13,44 +12,45 @@ const BlogCard = ({ post, showSummary, siteInfo }) => { const showPageCover = CONFIG_FUKA.POST_LIST_COVER && post?.page_cover return ( - -
-
- +
+
+
+
+ - {post.title} + {post.title} - + - {(!showPreview || showSummary) && ( -

- {post.summary} -

- )} -
- - {showPageCover && ( - -
- {/* eslint-disable-next-line @next/next/no-img-element */} - {post.title} - {/* {post.title} */} + {(!showPreview || showSummary) && ( +

+ {post.summary} +

+ )}
- - )} -
- + + {showPageCover && ( + +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {post.title} + {/* {post.title} */} +
+ + )} +
+ +
+ ) } diff --git a/themes/fukasawa/components/BlogListPage.js b/themes/fukasawa/components/BlogListPage.js index 2f0af0df..c919ef94 100644 --- a/themes/fukasawa/components/BlogListPage.js +++ b/themes/fukasawa/components/BlogListPage.js @@ -1,5 +1,4 @@ import BLOG from '@/blog.config' -import { useEffect, useState } from 'react' import BlogCard from './BlogCard' import BlogPostListEmpty from './BlogListEmpty' import PaginationSimple from './PaginationSimple' @@ -15,25 +14,6 @@ import PaginationSimple from './PaginationSimple' const BlogListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE) const showNext = page < totalPage - const [colCount, changeCol] = useState(1) - - function updateCol() { - if (window.outerWidth > 1200) { - changeCol(3) - } else if (window.outerWidth > 900) { - changeCol(2) - } else { - changeCol(1) - } - } - - useEffect(() => { - updateCol() - window.addEventListener('resize', updateCol) - return () => { - window.removeEventListener('resize', updateCol) - } - }) if (!posts || posts.length === 0) { return @@ -41,10 +21,10 @@ const BlogListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { return (
{/* 文章列表 */} -
+
{posts?.map(post => ( -
- +
+
))}
diff --git a/themes/fukasawa/components/BlogListScroll.js b/themes/fukasawa/components/BlogListScroll.js index b6ec891c..fad59cec 100644 --- a/themes/fukasawa/components/BlogListScroll.js +++ b/themes/fukasawa/components/BlogListScroll.js @@ -14,18 +14,7 @@ import { useGlobal } from '@/lib/global' */ const BlogListScroll = props => { const { posts = [], siteInfo } = props - const [colCount, changeCol] = React.useState(1) const { locale } = useGlobal() - - function updateCol() { - if (window.outerWidth > 1200) { - changeCol(3) - } else if (window.outerWidth > 900) { - changeCol(2) - } else { - changeCol(1) - } - } const targetRef = React.useRef(null) const [page, updatePage] = React.useState(1) @@ -56,29 +45,23 @@ const BlogListScroll = props => { } React.useEffect(() => { - updateCol() window.addEventListener('scroll', scrollTrigger) - - window.addEventListener('resize', updateCol) return () => { - window.removeEventListener('resize', updateCol) window.removeEventListener('scroll', scrollTrigger) } - }) + }, []) if (!posts || posts.length === 0) { return } else { return ( -
+
{/* 文章列表 */} -
{postsToShow?.map(post => ( -
- +
+
))} -
diff --git a/themes/fukasawa/components/Card.js b/themes/fukasawa/components/Card.js index a330210d..e88dee68 100644 --- a/themes/fukasawa/components/Card.js +++ b/themes/fukasawa/components/Card.js @@ -1,10 +1,5 @@ const Card = ({ children, headerSlot, className }) => { - return
+ return
<>{headerSlot}
{children} diff --git a/themes/matery/components/BlogPostListScroll.js b/themes/matery/components/BlogPostListScroll.js index 33c5b577..fb4da657 100644 --- a/themes/matery/components/BlogPostListScroll.js +++ b/themes/matery/components/BlogPostListScroll.js @@ -57,9 +57,11 @@ const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG_MA return
{/* 文章列表 */} -
+
{postsToShow.map(post => ( - +
+ +
))}
From d5d92533911ed64b41b24b2028c7049e32774174 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 16 Mar 2023 15:31:38 +0800 Subject: [PATCH 6/8] =?UTF-8?q?cusdis=E5=A4=9C=E9=97=B4=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CusdisComponent.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/CusdisComponent.js b/components/CusdisComponent.js index f1fce6ef..83b962b5 100644 --- a/components/CusdisComponent.js +++ b/components/CusdisComponent.js @@ -2,10 +2,31 @@ import { useGlobal } from '@/lib/global' import { ReactCusdis } from 'react-cusdis' import BLOG from '@/blog.config' import { useRouter } from 'next/router' +import { useEffect } from 'react' const CusdisComponent = ({ frontMatter }) => { const { locale } = useGlobal() const router = useRouter() + const { isDarkMode } = useGlobal() + + // 处理cusdis主题 + useEffect(() => { + const cusdisThread = document?.getElementById('cusdis_thread') + const cusdisIframe = cusdisThread?.getElementsByTagName('iframe') + if (cusdisIframe) { + const cusdisWrapper = cusdisIframe[0]?.contentDocument?.getElementById('root') + if (isDarkMode) { + cusdisWrapper?.classList?.remove('light') + cusdisWrapper?.classList?.add('dark') + } else { + cusdisWrapper?.classList?.remove('dark') + cusdisWrapper?.classList?.add('light') + } + if (!cusdisWrapper?.firstElementChild?.classList?.contains('dark:text-gray-100')) { + cusdisWrapper?.firstElementChild?.classList?.add('dark:text-gray-100') + } + } + }) return Date: Fri, 17 Mar 2023 23:45:50 +0800 Subject: [PATCH 7/8] hexo-card-two-line --- styles/notion.css | 7 +++++++ themes/hexo/components/BlogPostCardInfo.js | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/styles/notion.css b/styles/notion.css index 8b2b19ef..ee915f41 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -2010,4 +2010,11 @@ code.language-mermaid { .notion-equation-inline .katex-display { margin: 0 0 !important; +} + +.two-line-clamp { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; } \ No newline at end of file diff --git a/themes/hexo/components/BlogPostCardInfo.js b/themes/hexo/components/BlogPostCardInfo.js index 7355bac8..cc210e08 100644 --- a/themes/hexo/components/BlogPostCardInfo.js +++ b/themes/hexo/components/BlogPostCardInfo.js @@ -41,8 +41,7 @@ export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary {/* 摘要 */} {(!showPreview || showSummary) && !post.results && ( -

+

{post.summary}

)} From 3eeb0abc70fb7507a667bf0a603665d19617c233 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 17 Mar 2023 23:47:39 +0800 Subject: [PATCH 8/8] hexo-card-line-search --- themes/hexo/components/BlogPostCardInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/hexo/components/BlogPostCardInfo.js b/themes/hexo/components/BlogPostCardInfo.js index cc210e08..e55394c1 100644 --- a/themes/hexo/components/BlogPostCardInfo.js +++ b/themes/hexo/components/BlogPostCardInfo.js @@ -48,7 +48,7 @@ export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary {/* 搜索结果 */} {post.results && ( -

+

{post.results.map(r => ( {r} ))}