feat(frontend): add design tokens, dark mode hook, and i18n scaffold

Part of the Ombrora Convert redesign (Task 1/5).
This commit is contained in:
2026-07-31 14:49:19 +02:00
parent f499196dae
commit ee18cc2d90
8 changed files with 359 additions and 90 deletions
+27
View File
@@ -0,0 +1,27 @@
import { useEffect, useState } from 'react';
const STORAGE_KEY = 'theme';
function getInitialTheme() {
const stored = localStorage.getItem(STORAGE_KEY);
if (stored === 'light' || stored === 'dark') return stored;
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
export function useTheme() {
const [theme, setTheme] = useState(getInitialTheme);
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme);
}, [theme]);
function toggleTheme() {
setTheme((current) => {
const next = current === 'dark' ? 'light' : 'dark';
localStorage.setItem(STORAGE_KEY, next);
return next;
});
}
return { theme, toggleTheme };
}