import { useState } from 'react'; import { biergartenThemes, defaultThemeName, isBiergartenTheme, type ThemeName, themeStorageKey, } from '../themes'; const applyTheme = (theme: ThemeName) => { document.documentElement.setAttribute('data-theme', theme); localStorage.setItem(themeStorageKey, theme); }; const ThemeSwitcher = () => { const [selectedTheme, setSelectedTheme] = useState(() => { if (typeof window === 'undefined') { return defaultThemeName; } const savedTheme = localStorage.getItem(themeStorageKey); return isBiergartenTheme(savedTheme) ? savedTheme : defaultThemeName; }); const activeTheme = biergartenThemes.find((theme) => theme.value === selectedTheme) ?? biergartenThemes[0]; return ( <>

Theme Guide

Four themes, four moods — from the sun-bleached clarity of a Weizen afternoon to the deep berry dark of a Cassis barrel. Every theme shares the same semantic token structure so components stay consistent while the atmosphere shifts completely.

Active theme: {activeTheme.label} — {activeTheme.vibe}

Theme switcher

Pick a theme and preview it immediately.

{biergartenThemes.map((theme) => { const checked = selectedTheme === theme.value; return ( ); })}
); }; export default ThemeSwitcher;