diff --git a/lib/cli/src/generators/SVELTE/template-csf/stories/0-welcome.stories.js b/lib/cli/src/generators/SVELTE/template-csf/stories/0-welcome.stories.js new file mode 100644 index 000000000000..50efe67d1c0e --- /dev/null +++ b/lib/cli/src/generators/SVELTE/template-csf/stories/0-welcome.stories.js @@ -0,0 +1,15 @@ +import Welcome from './welcome.svelte'; + +export default { + title: 'Welcome', + component: Welcome, +}; + +export const ToStorybook = () => ({ + Component: Welcome, + props: {}, +}); + +ToStorybook.story = { + name: 'to Storybook', +}; diff --git a/lib/cli/src/generators/SVELTE/template-csf/stories/1-button.stories.js b/lib/cli/src/generators/SVELTE/template-csf/stories/1-button.stories.js new file mode 100644 index 000000000000..5ab76bba6ffe --- /dev/null +++ b/lib/cli/src/generators/SVELTE/template-csf/stories/1-button.stories.js @@ -0,0 +1,56 @@ +import { action } from '@storybook/addon-actions'; +import { linkTo } from '@storybook/addon-links'; + +import Button from './button.svelte'; + +export default { + title: 'Button', + component: Button, +}; + +export const Text = () => ({ + Component: Button, + props: { text: 'Hello Button' }, + on: { click: action('clicked') }, +}); + +export const Emoji = () => ({ + Component: Button, + props: { + text: '😀 😎 👍 💯', + }, + on: { click: action('clicked') }, +}); + +Emoji.story = { + parameters: { notes: 'My notes on a button with emojis' }, +}; + +export const WithSomeEmojiAndAction = () => ({ + Component: Button, + props: { + text: '😀 😎 👍 💯', + }, + on: { + click: action('This was clicked'), + }, +}); + +WithSomeEmojiAndAction.story = { + name: 'with some emoji and action', + parameters: { notes: 'My notes on a button with emojis' }, +}; + +export const ButtonWithLinkToAnotherStory = () => ({ + Component: Button, + props: { + text: 'Go to Welcome Story', + }, + on: { + click: linkTo('Welcome'), + }, +}); + +ButtonWithLinkToAnotherStory.story = { + name: 'button with link to another story', +}; diff --git a/lib/cli/src/generators/SVELTE/template-csf/stories/index.stories.js b/lib/cli/src/generators/SVELTE/template-csf/stories/index.stories.js deleted file mode 100644 index 944233291921..000000000000 --- a/lib/cli/src/generators/SVELTE/template-csf/stories/index.stories.js +++ /dev/null @@ -1,22 +0,0 @@ -import { action } from '@storybook/addon-actions'; - -import Button from './button.svelte'; - -export default { - title: 'Button', - component: Button, -}; - -export const Text = () => ({ - Component: Button, - props: { text: 'Hello Button' }, - on: { click: action('clicked') }, -}); - -export const Emoji = () => ({ - Component: Button, - props: { - text: '😀 😎 👍 💯', - }, - on: { click: action('clicked') }, -}); diff --git a/lib/cli/src/generators/SVELTE/template-csf/stories/welcome.svelte b/lib/cli/src/generators/SVELTE/template-csf/stories/welcome.svelte new file mode 100644 index 000000000000..b86218e10096 --- /dev/null +++ b/lib/cli/src/generators/SVELTE/template-csf/stories/welcome.svelte @@ -0,0 +1,37 @@ + + + + +
+

Welcome to storybook

+

This is a UI component dev environment for your app.

+

+ We've added some basic stories inside the + stories + directory. +
+ A story is a single state of one or more UI components. You can have as many stories as you + want. +
+ (Basically a story is like a visual test case.) +

+