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

🔧 🐛 + 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 { 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/hexo/components/BlogPostCardInfo.js b/themes/hexo/components/BlogPostCardInfo.js index 7355bac8..e55394c1 100644 --- a/themes/hexo/components/BlogPostCardInfo.js +++ b/themes/hexo/components/BlogPostCardInfo.js @@ -41,15 +41,14 @@ export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary {/* 摘要 */} {(!showPreview || showSummary) && !post.results && ( -

+

{post.summary}

)} {/* 搜索结果 */} {post.results && ( -

+

{post.results.map(r => ( {r} ))} diff --git a/themes/hexo/components/MenuButtonGroupTop.js b/themes/hexo/components/MenuButtonGroupTop.js index f6ae7a29..866898e8 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 }, @@ -36,12 +37,12 @@ const MenuButtonGroupTop = (props) => {

- ); + ) } else { return null } })} - ); + ) } export default MenuButtonGroupTop 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, // 显示归档 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 && } 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 => ( - +
+ +
))}