diff --git a/themes/heo/components/BlogPostCard.js b/themes/heo/components/BlogPostCard.js index b954241a435..c6e09f4a537 100644 --- a/themes/heo/components/BlogPostCard.js +++ b/themes/heo/components/BlogPostCard.js @@ -1,5 +1,5 @@ import LazyImage from '@/components/LazyImage' -import NotionIcon from '@/components/NotionIcon' +import NotionIcon from './NotionIcon' import { siteConfig } from '@/lib/config' import Link from 'next/link' import CONFIG from '../config' @@ -29,7 +29,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { return (
+ className={` ${COVER_HOVER_ENLARGE} ? ' hover:transition-all duration-150' : ''}`}>
{ priority={index === 0} src={post?.pageCoverThumbnail} alt={post?.title} - className='h-60 w-full object-cover group-hover:scale-105 group-hover:brightness-75 transition-all duration-300' + className='h-full w-full object-cover group-hover:scale-105 group-hover:brightness-75 transition-all duration-500 ease-in-out' //宽高都调整为自适应,保证封面居中 />
@@ -74,7 +74,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { )} - {/* 标题 */} + {/* 标题和图标 */} { ' group-hover:text-indigo-700 dark:hover:text-yellow-700 dark:group-hover:text-yellow-600 text-black dark:text-gray-100 line-clamp-2 replace cursor-pointer text-xl font-extrabold leading-tight' }> {siteConfig('POST_TITLE_ICON') && ( - + )} {post.title} diff --git a/themes/heo/components/NotionIcon.js b/themes/heo/components/NotionIcon.js new file mode 100644 index 00000000000..c6d5bed170c --- /dev/null +++ b/themes/heo/components/NotionIcon.js @@ -0,0 +1,22 @@ +import LazyImage from '@/components/LazyImage' + +/** + * notion的图标icon + * 可能是emoji 可能是 svg 也可能是 图片 + * @returns + */ +const NotionIcon = ({ icon, className = 'w-8 h-8 my-auto inline mr-1' }) => { + if (!icon) { + return <> + } + + if (icon.startsWith('http') || icon.startsWith('data:')) { + // 这里优先使用传入的 className + return + } + + // 对于 emoji 或 svg,设置默认 className,也可以传递不同的样式 + return {icon} +} + +export default NotionIcon