A few storybook migrations - #48037
Conversation
| const Template = args => <ConfirmDeleteButton {...args} />; | ||
|
|
||
| export const BasicExample = Template.bind({}); | ||
| BasicExample.args = { |
There was a problem hiding this comment.
For a scenario like this where there's only only story, is it better to list the args separate like this or to just include them in the template itself?
There was a problem hiding this comment.
Good question, my thought was to keep it separate to make it easier to add more stories in the future, but I am open to suggestion.
There was a problem hiding this comment.
I had the same question. I had 2 files with just one story each and included the args in the template. I'm good either way. @madelynkasula do you have a preference?
There was a problem hiding this comment.
I'm also listening in to this conversation. I went with Molly's route for consistency and expandability.
There was a problem hiding this comment.
my thought was to keep it separate to make it easier to add more stories in the future
+1 to molly's comment. if the props are something that all stories will want (e.g., the isOpen prop for a dialog will always be true so we can render the dialog in every story), i hard-code those args in the template. otherwise, i keep them in individual stories.
i lean toward the latter (keeping props in individual stories) because it's easier to move these props into the template later than it is to do the reverse refactor
There was a problem hiding this comment.
Thanks @madelynkasula ! I was also wondering about naming convention for a component with only story - I see default was used sometimes in the old Storybook version, or the name of the component itself. I ended up using BasicExample but someone also use Basic. Is there a preference?
There was a problem hiding this comment.
hmmmm, that's a good question, alice. i think using the name of the component is redundant since all stories are nested under the component name. otherwise, it doesn't really matter, but we should set a convention to be consistent! let's go with "BasicExample" unless others have opinions
| </div> | ||
| )); | ||
| export default { | ||
| title: 'CrossTabCharts', |
There was a problem hiding this comment.
nit: title should be the same as component name
| const Template = args => <ConfirmDeleteButton {...args} />; | ||
|
|
||
| export const BasicExample = Template.bind({}); | ||
| BasicExample.args = { |
There was a problem hiding this comment.
my thought was to keep it separate to make it easier to add more stories in the future
+1 to molly's comment. if the props are something that all stories will want (e.g., the isOpen prop for a dialog will always be true so we can render the dialog in every story), i hard-code those args in the template. otherwise, i keep them in individual stories.
i lean toward the latter (keeping props in individual stories) because it's easier to move these props into the template later than it is to do the reverse refactor
Moving to the new api for storybook for:
Links