- add lucide-react for Sun/Moon icons - add useTheme hook persisting choice to localStorage with prefers-color-scheme fallback - add ThemeSwitcher button component wired into SidePanel header - add blocking inline script to index.html to prevent flash-of-wrong-theme - move all *.stories.tsx from src/ into .storybook/stories/ and update imports - update main.ts stories glob to .storybook/stories/**
26 lines
775 B
TypeScript
26 lines
775 B
TypeScript
import type { StorybookConfig } from '@storybook/react-vite';
|
|
|
|
import { dirname } from "path"
|
|
|
|
import { fileURLToPath } from "url"
|
|
|
|
/**
|
|
* This function is used to resolve the absolute path of a package.
|
|
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
|
|
*/
|
|
function getAbsolutePath(value: string) {
|
|
return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)))
|
|
}
|
|
const config: StorybookConfig = {
|
|
"stories": [
|
|
"./stories/**/*.mdx",
|
|
"./stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
|
],
|
|
"addons": [
|
|
getAbsolutePath('@storybook/addon-vitest'),
|
|
getAbsolutePath('@storybook/addon-a11y'),
|
|
getAbsolutePath('@storybook/addon-docs')
|
|
],
|
|
"framework": getAbsolutePath('@storybook/react-vite')
|
|
};
|
|
export default config; |