feat: dynamic loading of PostActions and PostToc
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
import dynamic from "next/dynamic"
|
||||
import { type MutableRefObject } from "react"
|
||||
|
||||
import { PostActions } from "~/components/site/PostActions"
|
||||
import { PostToc } from "~/components/site/PostToc"
|
||||
import { ExpandedCharacter, ExpandedNote } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { renderPageContent } from "~/markdown"
|
||||
|
||||
import { PageContentContainer } from "./PageContentContainer"
|
||||
|
||||
const DynamicPostActions = dynamic(
|
||||
() => import("~/components/site/PostActions"),
|
||||
)
|
||||
const DynamicPostToc = dynamic(() => import("~/components/site/PostToc"))
|
||||
|
||||
export const PageContent = ({
|
||||
className,
|
||||
content,
|
||||
@@ -51,8 +55,10 @@ export const PageContent = ({
|
||||
<div className="xlog-post-content prose" ref={inputRef}>
|
||||
{inParsedContent?.element}
|
||||
</div>
|
||||
{toc && inParsedContent?.toc && <PostToc data={inParsedContent?.toc} />}
|
||||
{withActions && <PostActions page={page} site={site} />}
|
||||
{toc && inParsedContent?.toc && (
|
||||
<DynamicPostToc data={inParsedContent?.toc} />
|
||||
)}
|
||||
{withActions && <DynamicPostActions page={page} site={site} />}
|
||||
</>
|
||||
</PageContentContainer>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user