oa-ai/src/app/layout.tsx

39 lines
1.4 KiB
TypeScript

export const metadata = { title: 'OA 统一门户' }
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="zh-CN" suppressHydrationWarning>
<head>
<script dangerouslySetInnerHTML={{ __html: `
(function() {
try {
var t = localStorage.getItem('theme');
if (t === 'light' || t === 'dark') document.documentElement.classList.add(t);
else if (window.matchMedia('(prefers-color-scheme: dark)').matches) document.documentElement.classList.add('dark');
} catch(e) {}
})();
`}} />
<style>{`
:root {
--bg: #f8fafc; --bg-card: #fff; --bg-hover: #f1f5f9; --border: #e2e8f0;
--text: #0f172a; --text-secondary: #475569; --text-muted: #94a3b8;
}
.dark {
--bg: #020617; --bg-card: #0f172a; --bg-hover: #1e293b; --border: #1e293b;
--text: #f1f5f9; --text-secondary: #94a3b8; --text-muted: #64748b;
}
`}</style>
</head>
<body style={{
margin: 0,
background: 'var(--bg)',
color: 'var(--text)',
fontFamily: 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
transition: 'background 0.3s, color 0.3s',
}}>
{children}
</body>
</html>
)
}