Storybook: Difference between revisions
From AWVVO
Jump to navigationJump to search
Created page with "== Add to an existing projec without Storybook == <syntaxhighlight lang="bash" copy> npx storybook@latest init </syntaxhighlight>" |
|||
Line 2: | Line 2: | ||
<syntaxhighlight lang="bash" copy> | <syntaxhighlight lang="bash" copy> | ||
npx storybook@latest init | npx storybook@latest init | ||
</syntaxhighlight> | |||
== Change preview.js == | |||
<syntaxhighlight lang="js" copy> | |||
import { setup } from '@storybook/vue3'; | |||
import { createVuetify } from 'vuetify'; | |||
import 'vuetify/styles'; // Ensure Vuetify styles are loaded | |||
// Import theme styles (optional but recommended) | |||
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg'; | |||
import '@mdi/font/css/materialdesignicons.css'; | |||
import * as components from 'vuetify/components'; | |||
import * as directives from 'vuetify/directives'; | |||
const vuetify = createVuetify({ | |||
components, | |||
directives, | |||
icons: { | |||
defaultSet: 'mdi', | |||
aliases, | |||
sets: { mdi }, | |||
}, | |||
theme: { | |||
defaultTheme: 'light', // Explicitly set default theme | |||
}, | |||
}); | |||
setup((app) => { | |||
app.use(vuetify); | |||
}); | |||
/** @type { import('@storybook/vue3').Preview } */ | |||
const preview = { | |||
parameters: { | |||
controls: { | |||
matchers: { | |||
color: /(background|color)$/i, | |||
date: /Date$/i, | |||
}, | |||
}, | |||
}, | |||
}; | |||
export default preview; | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 17:15, 1 February 2025
Add to an existing projec without Storybook
npx storybook@latest init
Change preview.js
import { setup } from '@storybook/vue3';
import { createVuetify } from 'vuetify';
import 'vuetify/styles'; // Ensure Vuetify styles are loaded
// Import theme styles (optional but recommended)
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg';
import '@mdi/font/css/materialdesignicons.css';
import * as components from 'vuetify/components';
import * as directives from 'vuetify/directives';
const vuetify = createVuetify({
components,
directives,
icons: {
defaultSet: 'mdi',
aliases,
sets: { mdi },
},
theme: {
defaultTheme: 'light', // Explicitly set default theme
},
});
setup((app) => {
app.use(vuetify);
});
/** @type { import('@storybook/vue3').Preview } */
const preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};
export default preview;