♻️ refactor: 优化布局组件,调整动画效果并修复ScrollToTop组件的依赖

This commit is contained in:
2025-07-28 14:32:02 +08:00
parent faa793a68d
commit dc698da285
4 changed files with 17 additions and 11 deletions

View File

@ -14,13 +14,13 @@ export default function RootLayout({
const pathname = usePathname()
return (
<>
<header className="fixed top-0 left-0 w-full z-50 bg-white/80 dark:bg-slate-900/80 backdrop-blur flex justify-center border-b border-slate-200 dark:border-slate-800">
<Navbar />
</header>
<header className="fixed top-0 left-0 w-full z-50 bg-white/80 dark:bg-slate-900/80 backdrop-blur flex justify-center border-b border-slate-200 dark:border-slate-800">
<Navbar />
</header>
<motion.main
key={pathname}
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
transition={{
type: 'tween',
ease: 'easeOut',
@ -28,6 +28,7 @@ export default function RootLayout({
}}
className="pt-16"
>
<BackgroundProvider>
<div className='container mx-auto px-4 sm:px-6 lg:px-10 max-w-7xl'>{children}</div>
</BackgroundProvider>

View File

@ -12,5 +12,9 @@ export default async function PostPage({ params }: Props) {
const post = await getPostById(id, cookieStore.get('token')?.value || '');
if (!post)
return <div></div>
return <BlogPost post={post} />
return (
<div className="flex flex-col h-100vh">
<BlogPost post={post} />
</div>
)
}