Skip to content

Commit 666cf50

Browse files
committed
Rebuild Storybook components in vue
This commit migrates our storybook setup from react to vue, using the vue3/vite storybook package. Most functionality is preserved from react in storybook, with the only major change being in templating structure: whereas before we passed child components as jsx props, since Vue instead promotes using slots, we set the children of our stories using the template syntax. Also, there is not native vue-router support, so we have to mock the vue-router package around our stories in order to use any components that rely on vue-router package-specific components. The withVueRouter function is modeled after the same function found here[1] in a vue-router-storybook plugin. Since we have no demonstrated need for actually mocking the functionality of the router, it seemed the right decision to just include the bare minimum code needed to render the child components, rather than adding another dependency (that is both not actively maintained and depends on an earlier version of storybook). Issue #1009 Migrate Front-end to vue [1] https://github.com/NickMcBurney/storybook-vue3-router
1 parent 6425e4d commit 666cf50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2399
-2561
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ dist
118118
# @axa-fr/react-oidc generated files
119119
/public/OidcServiceWorker.js
120120
/public/OidcTrustedDomains.js
121+
122+
*storybook.log
123+
storybook-static

.storybook/main.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
import type { StorybookConfig } from '@storybook/react-vite';
1+
import type { StorybookConfig } from '@storybook/vue3-vite';
2+
23
const config: StorybookConfig = {
3-
stories: ['../src/stories/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
4-
addons: [
5-
'@storybook/addon-links',
6-
'@storybook/addon-essentials',
7-
'@storybook/addon-interactions',
8-
],
4+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5+
addons: ['@storybook/addon-onboarding', '@storybook/addon-docs'],
96
framework: {
10-
name: '@storybook/react-vite',
11-
options: {},
7+
name: '@storybook/vue3-vite',
8+
options: {
9+
docgen: {
10+
plugin: 'vue-component-meta',
11+
tsconfig: 'tsconfig.app.json',
12+
},
13+
},
1214
},
13-
core: {
14-
disableTelemetry: true,
15-
},
16-
docs: {
17-
autodocs: 'tag',
18-
},
19-
staticDirs: ['../public'],
2015
};
2116
export default config;

.storybook/preview.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Preview } from '@storybook/vue3-vite';
2+
import '../src/assets/main.css';
3+
4+
const preview: Preview = {
5+
parameters: {
6+
controls: {
7+
matchers: {
8+
color: /(background|color)$/i,
9+
date: /Date$/i,
10+
},
11+
},
12+
},
13+
};
14+
15+
export default preview;

.storybook/preview.tsx

Lines changed: 0 additions & 30 deletions
This file was deleted.

oldSrc/stories/Button.stories.tsx

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)