mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-02 15:10:16 +00:00
Merge pull request #2153 from tangly1024/feat/nobelium-post-preview
nobelium主题支持列表预览
This commit is contained in:
@@ -2,10 +2,13 @@ import Link from 'next/link'
|
|||||||
import { siteConfig } from '@/lib/config'
|
import { siteConfig } from '@/lib/config'
|
||||||
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
|
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
|
||||||
import NotionIcon from '@/components/NotionIcon'
|
import NotionIcon from '@/components/NotionIcon'
|
||||||
|
import NotionPage from '@/components/NotionPage'
|
||||||
|
|
||||||
const BlogPost = ({ post }) => {
|
const BlogPost = ({ post }) => {
|
||||||
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}`
|
||||||
|
|
||||||
|
const showPreview = siteConfig('POST_LIST_PREVIEW') && post.blockMap
|
||||||
|
|
||||||
return (
|
return (
|
||||||
(<Link href={url}>
|
(<Link href={url}>
|
||||||
|
|
||||||
@@ -19,9 +22,15 @@ const BlogPost = ({ post }) => {
|
|||||||
</time>
|
</time>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<p className="hidden md:block leading-8 text-gray-700 dark:text-gray-300">
|
{!showPreview && <p className="hidden md:block leading-8 text-gray-700 dark:text-gray-300">
|
||||||
{post.summary}
|
{post.summary}
|
||||||
</p>
|
</p>}
|
||||||
|
{showPreview && post?.blockMap && (
|
||||||
|
<div className="overflow-ellipsis truncate">
|
||||||
|
<NotionPage post={post} />
|
||||||
|
<hr className='border-dashed py-4'/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</main>
|
</main>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user