12279117f3
- CSS 变量驱动的主题系统,所有颜色响应 data-theme 属性 - 新增语义化色彩 heading/secondary/tertiary,替换硬编码 text-white/text-gray-* - 右上角三态主题按钮(自动/浅色/深色),全局可用无需登录 - layout.tsx 内联脚本防闪烁 - 修复个人中心页面溢出无法滚动
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import type { Metadata, Viewport } from "next";
|
|
import { Geist } from "next/font/google";
|
|
import "./globals.css";
|
|
import GlobalUserBadge from "@/components/GlobalUserBadge";
|
|
|
|
const geistSans = Geist({
|
|
variable: "--font-geist-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
title: "NoWhatever — 别说随便",
|
|
description: "像 Tinder 一样滑卡片,和朋友一起决定去哪吃!",
|
|
referrer: "no-referrer",
|
|
};
|
|
|
|
export const viewport: Viewport = {
|
|
width: "device-width",
|
|
initialScale: 1,
|
|
maximumScale: 1,
|
|
userScalable: false,
|
|
};
|
|
|
|
const themeScript = `(function(){try{var t=localStorage.getItem("nowhatever-theme")||"system";var r=t;if(t==="system")r=window.matchMedia("(prefers-color-scheme:light)").matches?"light":"dark";document.documentElement.setAttribute("data-theme",r)}catch(e){}})()`;
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html lang="zh-CN" suppressHydrationWarning>
|
|
<head>
|
|
<script dangerouslySetInnerHTML={{ __html: themeScript }} />
|
|
</head>
|
|
<body className={`${geistSans.variable} font-sans antialiased`}>
|
|
<GlobalUserBadge />
|
|
{children}
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|