-
-
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: web-components stories homogenization #10703
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = { | ||
stories: ['../stories/**/*.stories.js'], | ||
addons: ['@storybook/addon-actions', '@storybook/addon-links'], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { html } from 'lit-html'; | ||
|
||
export default { | ||
title: 'Welcome', | ||
}; | ||
|
||
export const ToStorybook = () => html`<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">src/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> | ||
<p> | ||
See these sample | ||
<a (click)="showApp.emit($event)" role="button" tabindex="0">stories</a> for a component called | ||
<span class="inline-code">Button</span> . | ||
</p> | ||
<p> | ||
Just like that, you can add your own components as stories. <br /> | ||
You can also edit those components and see changes right away. <br /> | ||
(Try editing the <span class="inline-code">Button</span> stories located at | ||
<span class="inline-code">src/stories/index.js</span>.) | ||
</p> | ||
<p> | ||
Usually we create stories with smaller UI components in the app.<br /> | ||
Have a look at the | ||
<a | ||
href="https://storybook.js.org/basics/writing-stories" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Writing Stories | ||
</a> | ||
section in our documentation. | ||
</p> | ||
<p class="note"> | ||
<b>NOTE:</b> <br /> | ||
Have a look at the <span class="inline-code">.storybook/webpack.config.js</span> to add webpack | ||
loaders and plugins you are using in this project. | ||
</p> | ||
</main>`; | ||
|
||
ToStorybook.story = { | ||
name: 'to Storybook', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { html } from 'lit-html'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
|
||
export default { | ||
title: 'Button', | ||
}; | ||
|
||
export const Text = () => html` | ||
<button @click=${action('clicked')}> | ||
Hello Button | ||
</button> | ||
`; | ||
|
||
export const Emoji = () => html` | ||
<button @click=${action('clicked')}> | ||
😀 😎 👍 💯 | ||
</button> | ||
`; | ||
|
||
Emoji.story = { | ||
parameters: { notes: 'My notes on a button with emojis' }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should get rid of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right @yannbf, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree we should get rid of Slight clarification on the deprecation. We won't release a 6.0 version of notes along with the Storybook release. We will release deprecated addons with the community on an independent schedule and will be looking for users of those addons to step up as maintainers if they want to keep them going There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, we should leave it out for now. |
||
}; | ||
|
||
export const WithSomeEmojiAndAction = () => html` | ||
<button @click=${action('This was clicked')}> | ||
😀 😎 👍 💯 | ||
</button> | ||
`; | ||
|
||
WithSomeEmojiAndAction.story = { | ||
name: 'with some emoji and action', | ||
parameters: { notes: 'My notes on a button with emojis' }, | ||
}; | ||
|
||
export const ButtonWithLinkToAnotherStory = () => html`<button @click=${linkTo('Welcome')}> | ||
Go to Welcome Story | ||
</button>`; | ||
|
||
ButtonWithLinkToAnotherStory.story = { | ||
name: 'button with link to another story', | ||
}; |
This file was deleted.
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.
I think we can remove that as I'm not sure there will be a
.storybook/webpack.config.js
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.
You are right, the template does not contain such file:
However it's nice to tell people that if they add a
webpack.config.js
file it will be picked up, so maybe just rephrase that? Also, that sentence is in every framework's template, so if we were to make a change, it has to be synced with the others.@shilman what's your take on this?
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.
AFAIK the current recommendation is to override
webpackFinal
inmain.js
, so we should probably update all the docs accordingly.webpack.config.js
is still supported (for now, not sure how long we plan to keep this? But we should be directing everybody towards the recommendation. @ndelangen please feel free to correct if I got any of this wrong.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.
indeed