import type { Decorator, Preview } from '@storybook/react'; import '../src/styles/fonts.css'; import '../src/styles/index.css'; import { ThemeProvider, type Theme, type Tint } from '../src/components/ThemeProvider/ThemeProvider'; import { colorSchemes } from '../src/lib/tokens'; const withTheme: Decorator = (Story, context) => { const theme = (context.globals.theme ?? 'dark') as Theme; const scheme = colorSchemes.find((s) => s.id === context.globals.scheme) ?? colorSchemes[0]; const tint = (context.globals.tint ?? 'off') as Tint; const layout = context.parameters.layout ?? 'padded'; return ( ); }; const preview: Preview = { decorators: [withTheme], globalTypes: { theme: { description: 'Design', toolbar: { title: 'Design', icon: 'contrast', items: [ { value: 'dark', title: 'Dunkel', icon: 'moon' }, { value: 'light', title: 'Hell', icon: 'sun' }, ], dynamicTitle: true, }, }, scheme: { description: 'Farbschema', toolbar: { title: 'Farbschema', icon: 'paintbrush', items: colorSchemes.map((s) => ({ value: s.id, title: s.name })), dynamicTitle: true, }, }, tint: { description: 'Neutraltöne einfärben', toolbar: { title: 'Tönung', icon: 'mirror', items: [ { value: 'off', title: 'Aus' }, { value: 'subtle', title: 'Leicht' }, { value: 'strong', title: 'Kräftig' }, ], dynamicTitle: true, }, }, }, initialGlobals: { theme: 'dark', scheme: 'violett', tint: 'off', }, parameters: { layout: 'padded', backgrounds: { disable: true }, controls: { matchers: { color: /(background|color)$/i }, sort: 'requiredFirst', }, options: { storySort: { order: ['Einführung', 'Grundlagen', 'Formulare', 'Anzeige', 'Overlays', 'Navigation', 'Aufgaben', 'Gruppen', 'Kalender', 'Einstellungen', 'Anmeldung'], }, }, }, }; export default preview;