Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: svelte stories homogenization #10704

Merged
merged 1 commit into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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',
};
Original file line number Diff line number Diff line change
@@ -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',
};

This file was deleted.

37 changes: 37 additions & 0 deletions lib/cli/src/generators/SVELTE/template-csf/stories/welcome.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script>

</script>

<style>
main {
padding: 15px;
line-height: 1.4;
font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;
background-color: #ffffff;
}

.inline-code {
font-size: 15px;
font-weight: 600;
padding: 2px 5px;
border: 1px solid #eae9e9;
border-radius: 4px;
background-color: #f3f2f2;
color: #3a3a3a;
}
</style>

<main>
<h1>Welcome to storybook</h1>
<p>This is a UI component dev environment for your app.</p>
Copy link
Member

@yannbf yannbf May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep consistency on the content of the Welcome component? There is useful info in other components that I don't see here, such as telling users about hot module reloading, a link to storybook repo and explanation over the webpack config file.

Edit: Moving this discussion to #10723 please respond there 🚀

<p>
We've added some basic stories inside the
<span class="inline-code">stories</span>
directory.
<br />
A story is a single state of one or more UI components. You can have as many stories as you
want.
<br />
(Basically a story is like a visual test case.)
</p>
</main>