feat: light theme by default with dark toggle, CSS variables, FOUC prevention, theme persistence

This commit is contained in:
Alexey Pavlov
2026-05-31 17:39:26 +03:00
parent 1a1eac16ee
commit 76eb519018
6 changed files with 131 additions and 19 deletions
+15 -1
View File
@@ -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