feat: light theme by default with dark toggle, CSS variables, FOUC prevention, theme persistence
This commit is contained in:
+15
-1
@@ -5,10 +5,24 @@ export const metadata = {
|
||||
description: 'Инструмент для ведения Telegram-каналов с помощью ИИ',
|
||||
};
|
||||
|
||||
// Inline-скрипт чтобы установить тему ДО рендера и избежать вспышки
|
||||
const themeInit = `
|
||||
(function() {
|
||||
try {
|
||||
var saved = localStorage.getItem('zp_theme');
|
||||
var theme = saved || 'light';
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
} catch(e) {
|
||||
document.documentElement.setAttribute('data-theme', 'light');
|
||||
}
|
||||
})();
|
||||
`;
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html lang="ru">
|
||||
<html lang="ru" data-theme="light" suppressHydrationWarning>
|
||||
<head>
|
||||
<script dangerouslySetInnerHTML={{ __html: themeInit }} />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
|
||||
<link
|
||||
|
||||
Reference in New Issue
Block a user