-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
lib/cli/src/generators/SVELTE/template-csf/stories/0-welcome.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; |
56 changes: 56 additions & 0 deletions
56
lib/cli/src/generators/SVELTE/template-csf/stories/1-button.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; |
22 changes: 0 additions & 22 deletions
22
lib/cli/src/generators/SVELTE/template-csf/stories/index.stories.js
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
lib/cli/src/generators/SVELTE/template-csf/stories/welcome.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
<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> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 🚀