diff --git a/src/components/common/PageContent.tsx b/src/components/common/PageContent.tsx
index bdca1f04..1aba7ac0 100644
--- a/src/components/common/PageContent.tsx
+++ b/src/components/common/PageContent.tsx
@@ -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 = ({
{inParsedContent?.element}
- {toc && inParsedContent?.toc && }
- {withActions && }
+ {toc && inParsedContent?.toc && (
+
+ )}
+ {withActions && }
>
)
diff --git a/src/components/site/PostActions.tsx b/src/components/site/PostActions.tsx
index 01ebc9e2..9a5c0631 100644
--- a/src/components/site/PostActions.tsx
+++ b/src/components/site/PostActions.tsx
@@ -9,7 +9,7 @@ import { ExpandedCharacter, ExpandedNote } from "~/lib/types"
import { usePostFooterInView } from "./PostFooter"
-export const PostActions = ({
+const PostActions = ({
page,
site,
}: {
@@ -55,3 +55,5 @@ export const PostActions = ({
)
}
+
+export default PostActions
diff --git a/src/components/site/PostToc.tsx b/src/components/site/PostToc.tsx
index 2945236a..e0156cc0 100644
--- a/src/components/site/PostToc.tsx
+++ b/src/components/site/PostToc.tsx
@@ -6,7 +6,7 @@ import katex from "katex"
import type { List } from "mdast"
import { toHast } from "mdast-util-to-hast"
import type { Result as TocResult } from "mdast-util-toc"
-import React, { createElement, useEffect, useRef, useState } from "react"
+import React, { createElement, useEffect, useState } from "react"
import { scrollTo } from "~/lib/utils"
@@ -130,17 +130,12 @@ function Items(props: ItemsProps) {
)
}
-export const PostToc = ({ data }: { data: TocResult }) => {
- const containerRef = useRef(null)
-
+const PostToc = ({ data }: { data: TocResult }) => {
const idList = getIds(data?.map)
const activeId = useActiveId(idList)
return (
-
+
{
)
}
+
+export default PostToc