feat: светлая тема как основная + переключатель тем

- CSS-переменные --bg, --surface, --ink, --mute, --accent для обеих тем
- darkMode: 'class' в Tailwind config
- ThemeToggle компонент с Sun/Moon, сохраняет выбор в localStorage
- Inline-скрипт в layout.js защищает от FOUC (FlashOfUnstyledContent)
- Авто-определение по prefers-color-scheme как fallback
- not-found.js: красивая 404 страница вместо дефолтной Next
- Обновлены все компоненты и страницы — Header, Footer, ArticleCard, page.js, blog, tag, about
This commit is contained in:
Alexey Pavlov
2026-05-31 09:07:44 +03:00
parent d8d1affcc8
commit a16bf812e4
12 changed files with 231 additions and 75 deletions
+22 -20
View File
@@ -1,5 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: 'class',
content: [
'./app/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
@@ -7,14 +8,15 @@ module.exports = {
theme: {
extend: {
colors: {
bg: '#0a0a0a',
surface: '#141414',
surface2: '#1c1c1c',
border: '#2a2a2a',
accent: '#10b981',
accent2: '#34d399',
ink: '#e5e7eb',
mute: '#9ca3af',
// Используем CSS-переменные напрямую — для совместимости со старым кодом
bg: 'rgb(var(--bg) / <alpha-value>)',
surface: 'rgb(var(--surface) / <alpha-value>)',
surface2: 'rgb(var(--surface-2) / <alpha-value>)',
border: 'rgb(var(--border) / <alpha-value>)',
ink: 'rgb(var(--ink) / <alpha-value>)',
mute: 'rgb(var(--mute) / <alpha-value>)',
accent: 'rgb(var(--accent) / <alpha-value>)',
accent2: 'rgb(var(--accent-2) / <alpha-value>)',
},
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
@@ -23,18 +25,18 @@ module.exports = {
typography: ({ theme }) => ({
DEFAULT: {
css: {
'--tw-prose-body': theme('colors.ink'),
'--tw-prose-headings': '#ffffff',
'--tw-prose-links': theme('colors.accent2'),
'--tw-prose-bold': '#ffffff',
'--tw-prose-quotes': theme('colors.mute'),
'--tw-prose-quote-borders': theme('colors.accent'),
'--tw-prose-code': theme('colors.accent2'),
'--tw-prose-pre-bg': theme('colors.surface2'),
'--tw-prose-pre-code': theme('colors.ink'),
'--tw-prose-bullets': theme('colors.mute'),
'--tw-prose-counters': theme('colors.mute'),
'--tw-prose-hr': theme('colors.border'),
'--tw-prose-body': 'rgb(var(--ink))',
'--tw-prose-headings': 'rgb(var(--ink))',
'--tw-prose-links': 'rgb(var(--accent-2))',
'--tw-prose-bold': 'rgb(var(--ink))',
'--tw-prose-quotes': 'rgb(var(--mute))',
'--tw-prose-quote-borders': 'rgb(var(--accent))',
'--tw-prose-code': 'rgb(var(--accent-2))',
'--tw-prose-pre-bg': 'rgb(var(--surface-2))',
'--tw-prose-pre-code': 'rgb(var(--ink))',
'--tw-prose-bullets': 'rgb(var(--mute))',
'--tw-prose-counters': 'rgb(var(--mute))',
'--tw-prose-hr': 'rgb(var(--border))',
},
},
}),