48 أسطر
1.2 KiB
TypeScript
48 أسطر
1.2 KiB
TypeScript
import type { Metadata } from "next";
|
|
import "./globals.css";
|
|
import "./portfolio.css";
|
|
import { getDefaultSeoMetadata } from "@/data/seo";
|
|
import { siteUrl } from "@/data/site-config";
|
|
|
|
const themeInitScript = `
|
|
(() => {
|
|
try {
|
|
const storageKey = "grace-portfolio-theme";
|
|
const savedTheme = window.localStorage.getItem(storageKey);
|
|
const theme = savedTheme === "dark" ? "dark" : "light";
|
|
document.documentElement.dataset.theme = theme;
|
|
document.documentElement.style.colorScheme = theme;
|
|
} catch {
|
|
document.documentElement.dataset.theme = "light";
|
|
document.documentElement.style.colorScheme = "light";
|
|
}
|
|
})();
|
|
`;
|
|
|
|
export const metadata: Metadata = {
|
|
metadataBase: new URL(siteUrl),
|
|
...getDefaultSeoMetadata(),
|
|
};
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html
|
|
lang="en"
|
|
dir="ltr"
|
|
data-theme="light"
|
|
className="scroll-smooth"
|
|
style={{ colorScheme: "light" }}
|
|
suppressHydrationWarning
|
|
>
|
|
<head>
|
|
<script dangerouslySetInnerHTML={{ __html: themeInitScript }} />
|
|
</head>
|
|
<body className="bg-[var(--color-cream)] font-sans text-[var(--color-ink)] antialiased">{children}</body>
|
|
</html>
|
|
);
|
|
}
|