import { type ReactNode } from 'react'; import type { Preview } from '@storybook/react-vite'; // Not ideal to import from desktop-client, but we need a source of truth for theme variables // TODO: this needs refactoring import * as darkTheme from '../../desktop-client/src/style/themes/dark'; import * as developmentTheme from '../../desktop-client/src/style/themes/development'; import * as lightTheme from '../../desktop-client/src/style/themes/light'; import * as midnightTheme from '../../desktop-client/src/style/themes/midnight'; const THEMES = { light: lightTheme, dark: darkTheme, midnight: midnightTheme, development: developmentTheme, } as const; type ThemeName = keyof typeof THEMES; const ThemedStory = ({ themeName, children, }: { themeName?: ThemeName; children?: ReactNode; }) => { if (!themeName || !THEMES[themeName]) { throw new Error(`No theme specified`); } const css = Object.entries(THEMES[themeName]) .map(([key, value]) => `--color-${key}: ${value};`) .join('\n'); return (