diff --git a/docs/snippets/svelte/badge-story.mdx.mdx b/docs/snippets/svelte/badge-story.mdx.mdx index 987ebd1047f..d31eefe343d 100644 --- a/docs/snippets/svelte/badge-story.mdx.mdx +++ b/docs/snippets/svelte/badge-story.mdx.mdx @@ -3,35 +3,41 @@ import { Meta, Story, Canvas } from '@storybook/addon-docs'; -import { Badge } from './Badge.svelte'; +import Badge from './Badge.svelte'; -export const Template = (args) => ({ - Component: Badge, - props: args, -}); + # Badge Let's define a story for our `Badge` component: - - {Template.bind({})} - + ({ + Component: Badge, + props: args, + })} /> + We can drop it in a `Canvas` to get a code snippet: - - {Template.bind({})} - + ({ + Component: Badge, + props: args, + })} /> We can even preview multiple Stories in a block. This @@ -39,23 +45,37 @@ gets rendered as a group but defines individual stories with unique URLs, which is great for review and testing. - - {Template.bind({})} - - - {Template.bind({})} - - - {Template.bind({})} - + ({ + Component: Badge, + props: args, + })} /> + + ({ + Component: Badge, + props: args, + })} /> + + ({ + Component: Badge, + props: args, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/button-story-default-docs-code.mdx.mdx b/docs/snippets/svelte/button-story-default-docs-code.mdx.mdx index 734b9c53c9b..941e8fe5363 100644 --- a/docs/snippets/svelte/button-story-default-docs-code.mdx.mdx +++ b/docs/snippets/svelte/button-story-default-docs-code.mdx.mdx @@ -21,6 +21,8 @@ export const someFunction = (someValue) => { return `i am a ${someValue}`; }; + + { primary: true, size: 'small', label: "button", - }}> - {(args) => { + }} + render={(args) => { const { label } = args; const functionResult = someFunction(label); return { @@ -40,5 +42,5 @@ export const someFunction = (someValue) => { }, }; }} - +/> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/button-story-with-args.mdx.mdx b/docs/snippets/svelte/button-story-with-args.mdx.mdx index 31a439535a2..c09e8dc74e7 100644 --- a/docs/snippets/svelte/button-story-with-args.mdx.mdx +++ b/docs/snippets/svelte/button-story-with-args.mdx.mdx @@ -5,19 +5,18 @@ import { Meta, Story } from '@storybook/addon-docs'; import Button from './Button.svelte'; - + -export const Template = (args) => ({ - Component: Button, - props: args, -}); + - {Template.bind({})} - + }} + render={(args)=>({ + Component: Button, + props: args, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/button-story-with-emojis.mdx.mdx b/docs/snippets/svelte/button-story-with-emojis.mdx.mdx index 78b1dc8ec51..523eefe6a19 100644 --- a/docs/snippets/svelte/button-story-with-emojis.mdx.mdx +++ b/docs/snippets/svelte/button-story-with-emojis.mdx.mdx @@ -5,33 +5,37 @@ import { Meta, Story } from '@storybook/addon-docs'; import Button from './Button.svelte'; - + + - - {{ + ({ + Component: Button, props: { background: '#ff0', label: 'Button', }, - }} - - - - {{ + })} /> + + ({ + Component: Button, props: { background: '#ff0', label: 'πŸ˜„πŸ‘πŸ˜πŸ’―', }, - }} - - - - {{ - props: { + })} /> + + ({ + Component: Button, + props: { background: '#ff0', label: 'πŸ“šπŸ“•πŸ“ˆπŸ€“', }, - }} - + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/button-story.mdx.mdx b/docs/snippets/svelte/button-story.mdx.mdx index 43d30f35167..cc6a7ecc693 100644 --- a/docs/snippets/svelte/button-story.mdx.mdx +++ b/docs/snippets/svelte/button-story.mdx.mdx @@ -7,14 +7,17 @@ import Button from './Button.svelte'; + + # Button - - {{ + ({ + Component: Button, props: { primary: true, label: 'Button', }, - }} - + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/component-story-mdx-story-by-name.mdx.mdx b/docs/snippets/svelte/component-story-mdx-story-by-name.mdx.mdx index cada06ef055..5b443becbfb 100644 --- a/docs/snippets/svelte/component-story-mdx-story-by-name.mdx.mdx +++ b/docs/snippets/svelte/component-story-mdx-story-by-name.mdx.mdx @@ -1,16 +1,19 @@ ```md -import { Story } from '@storybook/addon-docs'; +import { Meta, Story } from '@storybook/addon-docs'; import Button from './Button.svelte'; -export const Template = (args) => ({ - Component: Button, - props: args, -}); + - - {Template.bind({})} - + + + ({ + Component: Button, + props: args, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/component-story-static-asset-cdn.mdx.mdx b/docs/snippets/svelte/component-story-static-asset-cdn.mdx.mdx index 74073dadbd3..0911014bb9b 100644 --- a/docs/snippets/svelte/component-story-static-asset-cdn.mdx.mdx +++ b/docs/snippets/svelte/component-story-static-asset-cdn.mdx.mdx @@ -5,17 +5,17 @@ import { Meta, Story } from '@storybook/addon-docs'; import MyComponent from './MyComponent.svelte'; - + - - {() => { - return { - Component: MyComponent, - props: { - src: 'https://place-hold.it/350x150', - alt: 'my image', - }, - }; - }} - + + + ({ + Component: MyComponent, + props: { + src: 'https://place-hold.it/350x150', + alt: 'my image', + }, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/component-story-static-asset-with-import.mdx.mdx b/docs/snippets/svelte/component-story-static-asset-with-import.mdx.mdx index 56492a6099b..a032fd009a9 100644 --- a/docs/snippets/svelte/component-story-static-asset-with-import.mdx.mdx +++ b/docs/snippets/svelte/component-story-static-asset-with-import.mdx.mdx @@ -7,21 +7,21 @@ import MyComponent from './MyComponent.svelte'; import imageFile from './static/image.png'; - + export const image = { src: imageFile, alt: 'my image', }; - - {() => { - return { - Component: MyComponent, - props: { - image: image, - }, - }; - }} - + + + ({ + Component: MyComponent, + props: { + image: image, + }, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/component-story-static-asset-without-import.mdx.mdx b/docs/snippets/svelte/component-story-static-asset-without-import.mdx.mdx index 7c7c636e360..58eaa68b1c9 100644 --- a/docs/snippets/svelte/component-story-static-asset-without-import.mdx.mdx +++ b/docs/snippets/svelte/component-story-static-asset-without-import.mdx.mdx @@ -5,17 +5,17 @@ import { Meta, Story } from '@storybook/addon-docs'; import MyComponent from './MyComponent.svelte0; - + - - {() => { - return { - Component: MyComponent, - props: { - src: '/image.png', - alt: 'my image', - }, - }; - }} - + + + ({ + Component: MyComponent, + props: { + src: '/image.png', + alt: 'my image', + }, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/loader-story.mdx.mdx b/docs/snippets/svelte/loader-story.mdx.mdx index fcda10e867d..2732de72da2 100644 --- a/docs/snippets/svelte/loader-story.mdx.mdx +++ b/docs/snippets/svelte/loader-story.mdx.mdx @@ -9,6 +9,8 @@ import fetch from 'node-fetch'; + + - {(args, { loaded: { todo } }) => ({ - Component: SampleLoaderComponent, + render={(args, { loaded: { todo } }) => ({ + Component: TodoItem, props: { ...args, todo, }, })} - +/> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/mdx-canvas-multiple-stories.mdx.mdx b/docs/snippets/svelte/mdx-canvas-multiple-stories.mdx.mdx index e369a3f7bf9..7bbcc90969d 100644 --- a/docs/snippets/svelte/mdx-canvas-multiple-stories.mdx.mdx +++ b/docs/snippets/svelte/mdx-canvas-multiple-stories.mdx.mdx @@ -1,12 +1,13 @@ ```md -import { Canvas } from '@storybook/addon-docs'; +import { Canvas, Meta, Story } from '@storybook/addon-docs'; -export const Template = (args) => ({ - Component: Badge, - props: args, -}); +import Badge from './Badge.svelte'; + + + + ({ args={{ status: 'warning', label: 'Warning', - }}> - {Template.bind({})} - - + }} + render={(args) => ({ + Component: Badge, + props: args, + })} /> + - {Template.bind({})} - + }} + render={(args) => ({ + Component: Badge, + props: args, + })} /> - {Template.bind({})} - + }} + render={(args) => ({ + Component: Badge, + props: args, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/my-component-story-configure-viewports.mdx.mdx b/docs/snippets/svelte/my-component-story-configure-viewports.mdx.mdx index c1dfed148b6..73ceb9ac6b7 100644 --- a/docs/snippets/svelte/my-component-story-configure-viewports.mdx.mdx +++ b/docs/snippets/svelte/my-component-story-configure-viewports.mdx.mdx @@ -15,7 +15,9 @@ import MyComponent from './MyComponent.svelte'; defaultViewport: 'iphone6', }, }} -/> + component={MyComponent} /> + + - {() => { - return { - Component: MyComponent, - }; }} - + render={() => ({ + Component: MyComponent, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/my-component-story-use-globaltype.mdx.mdx b/docs/snippets/svelte/my-component-story-use-globaltype.mdx.mdx index 7cf31e8abb1..d6d43fd949e 100644 --- a/docs/snippets/svelte/my-component-story-use-globaltype.mdx.mdx +++ b/docs/snippets/svelte/my-component-story-use-globaltype.mdx.mdx @@ -1,7 +1,11 @@ ```md -import { Story } from '@storybook/addon-docs'; +import { Meta, Story } from '@storybook/addon-docs'; + +import MyComponent from './MyComponent.svelte'; + + export const getCaptionForLocale = (locale) => { switch(locale) { @@ -14,8 +18,10 @@ export const getCaptionForLocale = (locale) => { } }; - - {(args, { globals: { locale } }) => { + + + { const caption = getCaptionForLocale(locale); return { component: MyComponent, @@ -23,6 +29,5 @@ export const getCaptionForLocale = (locale) => { locale: caption, }, }; - }} - + }} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/my-component-with-env-variables.mdx.mdx b/docs/snippets/svelte/my-component-with-env-variables.mdx.mdx index 2d5fd8bc904..419ed44b1a5 100644 --- a/docs/snippets/svelte/my-component-with-env-variables.mdx.mdx +++ b/docs/snippets/svelte/my-component-with-env-variables.mdx.mdx @@ -7,10 +7,7 @@ import MyComponent from './MyComponent.svelte'; -export const Template = (args) => ({ - Component: MyComponent, - props: args, -}); + ({ args={{ propertyA: process.env.STORYBOOK_DATA_KEY, }} - > - {Template.bind({})} - + render={(args) => ({ + Component: MyComponent, + props: args, + })} /> ``` \ No newline at end of file diff --git a/docs/snippets/svelte/your-component.mdx.mdx b/docs/snippets/svelte/your-component.mdx.mdx index 88d9ec51e46..7bdd56e1eed 100644 --- a/docs/snippets/svelte/your-component.mdx.mdx +++ b/docs/snippets/svelte/your-component.mdx.mdx @@ -6,18 +6,18 @@ import { Meta, Story } from '@storybook/addon-docs'; import YourComponent from './YourComponent.svelte'; + - -export const Template = (args) => ({ - Component: YourComponent, - props: args, -}); + + - {Template.bind({})} - + args={{}} + render={(args) => ({ + Component: YourComponent, + props: args, + })} /> ``` \ No newline at end of file