import { useGlobal } from '@/lib/global' import Image from 'next/image' import Link from 'next/link' import Card from './Card' import TagItemMini from './TagItemMini' import CONFIG from '../config' import NotionPage from '@/components/NotionPage' import NotionIcon from '@/components/NotionIcon' import TwikooCommentCount from '@/components/TwikooCommentCount' import { formatDateFmt } from '@/lib/formatDate' import { siteConfig } from '@/lib/config' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' const BlogPostCard = ({ post, index, showSummary }) => { const { locale } = useGlobal() const showPreview = siteConfig('NEXT_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap // 动画样式 首屏卡片不用,后面翻出来的加动画 const aosProps = index > 2 ? { 'data-aos': 'fade-down', 'data-aos-duration': '400', 'data-aos-once': 'true', 'data-aos-anchor-placement': 'top-bottom' } : {} const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` return (
{/* 文章标题 */} {post.title}
{post.category && ( <> {post.category} | )} {post.date?.start_date}
{post.tagItems?.map(tag => ( ))}
{(!showPreview || showSummary) && !post.results && (

{post.summary}

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

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

)} {showPreview && post?.blockMap && (
)}
{locale.COMMON.ARTICLE_DETAIL}
{siteConfig('NEXT_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && (
{post.title}
)}
) } export default BlogPostCard