mirror of
https://github.com/IT4Change/boilerplate-frontend.git
synced 2025-12-13 07:35:53 +00:00
lint .storybook
This commit is contained in:
parent
38631ab7ba
commit
0c02458e53
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
build/
|
build/
|
||||||
coverage/
|
coverage/
|
||||||
|
!.storybook/
|
||||||
@ -8,11 +8,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
export const DEFAULT_THEME = 'light'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
themeName: String,
|
themeName: {
|
||||||
|
default: DEFAULT_THEME,
|
||||||
|
type: String,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@ -1,21 +1,22 @@
|
|||||||
import type { StorybookConfig } from "@storybook/vue3-vite";
|
import type { StorybookConfig } from '@storybook/vue3-vite'
|
||||||
|
|
||||||
const config: StorybookConfig = {
|
const config: StorybookConfig = {
|
||||||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
||||||
addons: [
|
addons: [
|
||||||
"@storybook/addon-links",
|
'@storybook/addon-links',
|
||||||
"@storybook/addon-essentials",
|
'@storybook/addon-essentials',
|
||||||
"@storybook/addon-interactions",
|
'@storybook/addon-interactions',
|
||||||
],
|
],
|
||||||
framework: {
|
framework: {
|
||||||
name: "@storybook/vue3-vite",
|
name: '@storybook/vue3-vite',
|
||||||
options: {},
|
options: {},
|
||||||
},
|
},
|
||||||
docs: {
|
docs: {
|
||||||
autodocs: "tag",
|
autodocs: 'tag',
|
||||||
},
|
},
|
||||||
core: {
|
core: {
|
||||||
disableTelemetry: true, // 👈 Disables telemetry
|
disableTelemetry: true, // 👈 Disables telemetry
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
export default config;
|
|
||||||
|
export default config
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
import type { Preview } from "@storybook/vue3";
|
import { setup } from '@storybook/vue3'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
|
|
||||||
import { withVuetifyTheme } from './withVuetifyTheme.decorator';
|
// eslint-disable-next-line import/no-relative-parent-imports
|
||||||
import i18n from '../renderer/i18n'
|
import i18n from '../renderer/i18n'
|
||||||
|
// eslint-disable-next-line import/no-relative-parent-imports
|
||||||
import CreateVuetify from '../renderer/vuetify'
|
import CreateVuetify from '../renderer/vuetify'
|
||||||
// .storybook/preview.js
|
|
||||||
|
|
||||||
import { setup } from '@storybook/vue3';
|
import { withVuetifyTheme } from './withVuetifyTheme.decorator'
|
||||||
|
|
||||||
|
import type { Preview } from '@storybook/vue3'
|
||||||
|
|
||||||
setup((app) => {
|
setup((app) => {
|
||||||
// Registers your app's plugins into Storybook
|
// Registers your app's plugins into Storybook
|
||||||
@ -15,9 +17,9 @@ setup((app) => {
|
|||||||
app.use(pinia)
|
app.use(pinia)
|
||||||
app.use(i18n)
|
app.use(i18n)
|
||||||
app.use(CreateVuetify(i18n))
|
app.use(CreateVuetify(i18n))
|
||||||
});
|
})
|
||||||
|
|
||||||
export const decorators = [withVuetifyTheme];
|
export const decorators = [withVuetifyTheme]
|
||||||
|
|
||||||
export const globalTypes = {
|
export const globalTypes = {
|
||||||
theme: {
|
theme: {
|
||||||
@ -35,11 +37,11 @@ export const globalTypes = {
|
|||||||
dynamicTitle: true,
|
dynamicTitle: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
|
||||||
const preview: Preview = {
|
const preview: Preview = {
|
||||||
parameters: {
|
parameters: {
|
||||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||||
controls: {
|
controls: {
|
||||||
matchers: {
|
matchers: {
|
||||||
color: /(background|color)$/i,
|
color: /(background|color)$/i,
|
||||||
@ -47,6 +49,6 @@ const preview: Preview = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
|
||||||
export default preview;
|
export default preview
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
// .storybook/withVeutifyTheme.decorator.js
|
import { h } from 'vue'
|
||||||
import { h } from 'vue';
|
|
||||||
import StoryWrapper from './StoryWrapper.vue';
|
|
||||||
|
|
||||||
export const DEFAULT_THEME = 'light';
|
import StoryWrapper, { DEFAULT_THEME } from './StoryWrapper.vue'
|
||||||
|
|
||||||
export const withVuetifyTheme = (storyFn, context) => {
|
export const withVuetifyTheme = (storyFn, context) => {
|
||||||
// Pull our global theme variable, fallback to DEFAULT_THEME
|
// Pull our global theme variable, fallback to DEFAULT_THEME
|
||||||
const themeName = context.globals.theme || DEFAULT_THEME;
|
const themeName = context.globals.theme || DEFAULT_THEME
|
||||||
const story = storyFn();
|
const story = storyFn()
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
return h(
|
return h(
|
||||||
@ -16,7 +14,7 @@ export const withVuetifyTheme = (storyFn, context) => {
|
|||||||
{
|
{
|
||||||
// Puts your story into StoryWrapper's "story" slot with your story args
|
// Puts your story into StoryWrapper's "story" slot with your story args
|
||||||
story: () => h(story, { ...context.args }),
|
story: () => h(story, { ...context.args }),
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|||||||
@ -77,10 +77,10 @@ The following endpoints are provided given the right command is executed:
|
|||||||
- [x] eslint
|
- [x] eslint
|
||||||
- [x] vitest
|
- [x] vitest
|
||||||
- [x] vue-i18n
|
- [x] vue-i18n
|
||||||
|
- [x] docker
|
||||||
- [ ] figma
|
- [ ] figma
|
||||||
- [ ] chromatic
|
- [ ] chromatic
|
||||||
- [ ] documentation?
|
- [ ] documentation?
|
||||||
- [ ] docker
|
|
||||||
- [ ] github actions
|
- [ ] github actions
|
||||||
|
|
||||||
## Known Problems
|
## Known Problems
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user