theme-simple

This commit is contained in:
tangly1024.com
2024-03-11 12:54:42 +08:00
parent c4382e7b8e
commit c6e0b6cf78
3 changed files with 22 additions and 11 deletions

View File

@@ -6,13 +6,15 @@ import { siteConfig } from '@/lib/config'
import LazyImage from '@/components/LazyImage'
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
import NotionIcon from '@/components/NotionIcon'
import NotionPage from '@/components/NotionPage'
export const BlogItem = props => {
const { post } = props
const showPageCover = siteConfig('SIMPLE_POST_COVER_ENABLE', false, CONFIG)
const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}`
const { post } = props
const showPageCover = siteConfig('SIMPLE_POST_COVER_ENABLE', false, CONFIG)
const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}`
const showPreview = siteConfig('POST_LIST_PREVIEW') && post.blockMap
return <div key={post.id} className="h-42 my-6 pb-12 border-b dark:border-gray-800" >
return <div key={post.id} className="h-42 my-6 pb-12 border-b dark:border-gray-800" >
{/* 文章标题 */}
<div className='flex'>
@@ -56,9 +58,18 @@ export const BlogItem = props => {
</header>
<main className="text-gray-700 dark:text-gray-300 leading-normal mb-6">
{post.summary}
{post.summary && <span>...</span>}
{!showPreview && <>
{post.summary}
{post.summary && <span>...</span>}
</>}
{showPreview && post?.blockMap && (
<div className="overflow-ellipsis truncate">
<NotionPage post={post} />
<hr className='border-dashed py-4' />
</div>
)}
</main>
</article>
</div>