diff --git a/.storybook/main.ts b/.storybook/main.ts index 1eea577b5c..275b0752fc 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -8,9 +8,6 @@ const config: StorybookConfig = { name: '@storybook/web-components-vite', options: {}, }, - docs: { - autodocs: true, - }, async viteFinal(config) { let build: BuildOptions = {}; if (process.env.CHROMATIC) { diff --git a/.storybook/preview.ts b/.storybook/preview.ts index cc4bf441e9..a1b2185129 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,6 +1,6 @@ import * as tokens from '@sbb-esta/lyne-design-tokens'; -import type { StoryContext } from '@storybook/types'; -import type { Decorator } from '@storybook/web-components'; +import type { Parameters, StoryContext } from '@storybook/types'; +import type { Decorator, Preview } from '@storybook/web-components'; import isChromatic from 'chromatic/isChromatic'; import { html } from 'lit'; @@ -41,7 +41,7 @@ const storybookViewports = breakpoints.reduce( {} as Record, ); -export const parameters = { +const parameters: Parameters = { // Set the viewports in Chromatic globally. chromatic: { delay: 2000, @@ -52,6 +52,7 @@ export const parameters = { breakpointNames, debounceTimeout: 10, }, + tags: ['autodocs'], docs: { toc: { ignoreSelector: '.docs-story h2', @@ -70,7 +71,7 @@ export const parameters = { }, }; -export const decorators: Decorator[] = [ +const decorators: Decorator[] = [ (story, context: StoryContext) => isChromatic() && context.parameters.layout !== 'fullscreen' ? html`
${story()}
` @@ -78,3 +79,11 @@ export const decorators: Decorator[] = [ withBackgroundDecorator, (story) => (isChromatic() ? html`
${story()}
` : story()), ]; + +const preview: Preview = { + decorators, + parameters, + tags: ['autodocs'], +}; + +export default preview;