feat(layout): integrate mode toggle in layout and simplify home page structure

This commit is contained in:
cfngc4594 2025-02-20 14:43:56 +08:00
parent 286a4739c3
commit 96c946a2ca
2 changed files with 9 additions and 13 deletions

View File

@ -1,5 +1,6 @@
import "./globals.css";
import type { Metadata } from "next";
import { ModeToggle } from "@/components/mode-toggle";
import { ThemeProvider } from "@/components/theme-provider";
export const metadata: Metadata = {
@ -14,14 +15,19 @@ export default function RootLayout({
}>) {
return (
<html lang="en" suppressHydrationWarning>
<body className="antialiased">
<body className="h-screen flex flex-col antialiased">
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
<header className="h-14 flex items-center justify-end px-8 border-b">
<ModeToggle />
</header>
<main className="flex-1">
{children}
</main>
</ThemeProvider>
</body>
</html>

View File

@ -1,15 +1,5 @@
import CodeEditor from "@/components/code-editor";
import { ModeToggle } from "@/components/mode-toggle";
export default function Home() {
return (
<div className="h-screen flex flex-col">
<header className="h-14 flex items-center justify-end px-8 border-b">
<ModeToggle />
</header>
<div className="flex-1">
<CodeEditor />
</div>
</div>
);
return <CodeEditor />;
}