From f83514cd2c2f3feaa44ce740289e9063c8dcca4d Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 29 Apr 2024 14:57:29 +0800 Subject: [PATCH] =?UTF-8?q?matery=20-=20image=20=E9=81=AE=E7=BD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/matery/components/BlogPostCard.js | 186 ++++++++++++----------- 1 file changed, 100 insertions(+), 86 deletions(-) diff --git a/themes/matery/components/BlogPostCard.js b/themes/matery/components/BlogPostCard.js index d9a9c79f..656e6ebf 100644 --- a/themes/matery/components/BlogPostCard.js +++ b/themes/matery/components/BlogPostCard.js @@ -1,104 +1,118 @@ -import { siteConfig } from '@/lib/config' -import Link from 'next/link' -import TagItemMini from './TagItemMini' -import CONFIG from '../config' -import TwikooCommentCount from '@/components/TwikooCommentCount' import LazyImage from '@/components/LazyImage' -import { formatDateFmt } from '@/lib/utils/formatDate' -import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' import NotionIcon from '@/components/NotionIcon' +import TwikooCommentCount from '@/components/TwikooCommentCount' +import { siteConfig } from '@/lib/config' +import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import { formatDateFmt } from '@/lib/utils/formatDate' +import Link from 'next/link' +import CONFIG from '../config' +import TagItemMini from './TagItemMini' +/** + * 博客列表:文章卡牌 + * @param {*} param0 + * @returns + */ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { - const showPreview = siteConfig('MATERY_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap + const showPreview = + siteConfig('MATERY_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap // matery 主题默认强制显示图片 if (post && !post.pageCoverThumbnail) { post.pageCoverThumbnail = siteInfo?.pageCover } - const showPageCover = siteConfig('MATERY_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail + const showPageCover = + siteConfig('MATERY_POST_LIST_COVER', null, CONFIG) && + post?.pageCoverThumbnail const delay = (index % 3) * 300 - const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` + const url = checkContainHttp(post.slug) + ? sliceUrlFromHttp(post.slug) + : `${siteConfig('SUB_PATH', '')}/${post.slug}` return ( -
- - {/* 固定高度 ,空白用图片拉升填充 */} -
- - {/* 头部图片 填充卡片 */} - {showPageCover && ( - -
- -

- {siteConfig('POST_TITLE_ICON') && }{post.title} -

-
- +
+ {/* 固定高度 ,空白用图片拉升填充 */} +
+ {/* 头部图片 填充卡片 */} + {showPageCover && ( + +
+ +

+ {siteConfig('POST_TITLE_ICON') && ( + )} + {post.title} +

+ {/* 放在图片的阴影遮罩,便于突出文字 */} +
+
+
+
+ + )} - {/* 文字描述 */} -
- {/* 描述 */} -
+ {/* 文字描述 */} +
+ {/* 描述 */} +
+ {(!showPreview || showSummary) && post.summary && ( +

+ {post.summary} +

+ )} - {(!showPreview || showSummary) && post.summary && ( -

- {post.summary} -

- )} +
+
+ + + {post.date?.start_date || post.lastEditedDay} + + +
+ + + {post.category} + +
+
-
-
- - - - {post.date?.start_date || post.lastEditedDay} - - - -
- - - - {post.category} - - -
-
- - {post?.tagItems && post?.tagItems.length > 0 && (<> -
-
-
-
- {' '} - {post.tagItems.map(tag => ( - - ))} -
-
-
- )} -
-
- -
+ {post?.tagItems && post?.tagItems.length > 0 && ( + <> +
+
+
+
+ {' '} + {post.tagItems.map(tag => ( + + ))} +
+
+
+ + )} + +
+
) }