boilerplate-frontend/.storybook/withVuetifyTheme.decorator.ts
2023-11-15 11:25:28 +01:00

22 lines
624 B
TypeScript

// .storybook/withVeutifyTheme.decorator.js
import { h } from 'vue';
import StoryWrapper from './StoryWrapper.vue';
export const DEFAULT_THEME = 'light';
export const withVuetifyTheme = (storyFn, context) => {
// Pull our global theme variable, fallback to DEFAULT_THEME
const themeName = context.globals.theme || DEFAULT_THEME;
const story = storyFn();
return () => {
return h(
StoryWrapper,
{ themeName }, // Props for StoryWrapper
{
// Puts your story into StoryWrapper's "story" slot with your story args
story: () => h(story, { ...context.args }),
}
);
};
};