From 107a55a2408780014db898aeb67ab72f4558f6a5 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 1 Sep 2024 11:41:13 +0800 Subject: [PATCH] =?UTF-8?q?heo=E4=B8=BB=E9=A2=98=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/heo/components/BlogPostCard.js | 32 ++++++++------------- themes/heo/components/BlogPostListPage.js | 11 +++---- themes/heo/components/BlogPostListScroll.js | 8 ++---- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/themes/heo/components/BlogPostCard.js b/themes/heo/components/BlogPostCard.js index c015be17ac8..b954241a435 100644 --- a/themes/heo/components/BlogPostCard.js +++ b/themes/heo/components/BlogPostCard.js @@ -1,14 +1,11 @@ import LazyImage from '@/components/LazyImage' import NotionIcon from '@/components/NotionIcon' import { siteConfig } from '@/lib/config' -import { useGlobal } from '@/lib/global' import Link from 'next/link' import CONFIG from '../config' import TagItemMini from './TagItemMini' const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { - const { NOTION_CONFIG } = useGlobal() - const showPreview = siteConfig('HEO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap if ( @@ -23,32 +20,29 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { post?.pageCoverThumbnail && !showPreview - const POST_TWO_COLS = siteConfig( - 'HEO_HOME_POST_TWO_COLS', - null, - NOTION_CONFIG + const POST_TWO_COLS = siteConfig('HEO_HOME_POST_TWO_COLS', true, CONFIG) + const COVER_HOVER_ENLARGE = siteConfig( + 'HEO_POST_LIST_COVER_HOVER_ENLARGE', + true, + CONFIG ) return (
+ className={` ${COVER_HOVER_ENLARGE} ? ' hover:scale-110 transition-all duration-150' : ''}`}>
{/* 图片封面 */} {showPageCover && (
{ {/* 文字区块 */}
{/* 分类 */} diff --git a/themes/heo/components/BlogPostListPage.js b/themes/heo/components/BlogPostListPage.js index e7629837586..9c33a6943e9 100644 --- a/themes/heo/components/BlogPostListPage.js +++ b/themes/heo/components/BlogPostListPage.js @@ -1,5 +1,6 @@ import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' +import CONFIG from '../config' import BlogPostCard from './BlogPostCard' import BlogPostListEmpty from './BlogPostListEmpty' import PaginationNumber from './PaginationNumber' @@ -14,14 +15,10 @@ import PaginationNumber from './PaginationNumber' */ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const showPagination = postCount >= POSTS_PER_PAGE - const POST_TWO_COLS = siteConfig( - 'HEO_HOME_POST_TWO_COLS', - null, - NOTION_CONFIG - ) + const POST_TWO_COLS = siteConfig('HEO_HOME_POST_TWO_COLS', true, CONFIG) if (!posts || posts.length === 0 || page > totalPage) { return } else { @@ -29,7 +26,7 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => {
{/* 文章列表 */}
+ className={`${POST_TWO_COLS && '2xl:grid 2xl:grid-cols-2'} grid-cols-1 gap-5`}> {posts?.map(post => ( } else { @@ -71,7 +67,7 @@ const BlogPostListScroll = ({
{/* 文章列表 */}
+ className={`${POST_TWO_COLS && '2xl:grid 2xl:grid-cols-2'} grid-cols-1 gap-5`}> {' '} {postsToShow.map(post => (