fix: preview page error

This commit is contained in:
DIYgod 2024-01-18 22:10:54 +08:00
parent 6dfc652fbf
commit 85572fed13
No known key found for this signature in database
2 changed files with 36 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import { useTranslations } from "next-intl"
import dynamic from "next/dynamic"
import { useParams } from "next/navigation"
import PostTitle from "~/components/site/PostTitle"
import PostTitle from "~/components/site/PostTitle.client"
import { useGetPage } from "~/queries/page"
import { useGetSite } from "~/queries/site"

View File

@ -0,0 +1,35 @@
import { useTranslations } from "next-intl"
import { cn } from "~/lib/utils"
export default function PostTitle({
icon,
title,
className,
center,
skipTranslate,
}: {
icon?: React.ReactNode
title?: string
className?: string
center?: boolean
skipTranslate?: boolean
}) {
const t = useTranslations()
return (
<h2
className={cn(
"xlog-post-title mb-8 flex items-center relative text-4xl font-extrabold",
{
"justify-center": center,
"text-center": center,
},
className,
)}
>
{icon}
<span>{skipTranslate ? title : t(title)}</span>
</h2>
)
}