Skip to content

CLI: Add HTML components and stories #12286

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

Merged
merged 2 commits into from
Aug 31, 2020
Merged

CLI: Add HTML components and stories #12286

merged 2 commits into from
Aug 31, 2020

Conversation

tooppaaa
Copy link
Contributor

Issue: #12173

What I did

Create html components and stories.
Not sure this is the perfect way to go but that does the job

How to test

  • E2E

@shilman
Copy link
Member

shilman commented Aug 27, 2020

Looks good @tooppaaa ! My only concern is that all of the examples use JS functions with DOM methods and there are no plain "return a string of HTML" examples, which I think is a common case. Do you think this is an issue for first time users? To me it makes @storybook/html look more complicated than it actually is. Maybe I'm overthinking.

@tooppaaa
Copy link
Contributor Author

Opinion shared. What do you think of adding a comment ?
That won't impact stories, we keep it consistent for all frameworks, but shows how to do a story differently ?

},
};

const Template = (args) => createButton(args);
Copy link
Contributor Author

@tooppaaa tooppaaa Aug 28, 2020

Choose a reason for hiding this comment

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

const Template = ({label, ...args}) => {
// You can either use a function to create DOM elements or use a plain html string!
//  return `<div>${label}</div>`;
return createButton({label, ...args});
};

Copy link
Member

@gaetanmaisse gaetanmaisse left a comment

Choose a reason for hiding this comment

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

LGTM! One more time, good job @tooppaaa! 👏

For the HTML string concern, I have no idea if @storybook/html is widely used, if not a comment may be enough.

@shilman shilman changed the title CLI: add html components and stories CLI: Add HTML components and stories Aug 31, 2020
@shilman shilman merged commit fb28998 into next Aug 31, 2020
@shilman shilman deleted the feature/htmlCLI branch August 31, 2020 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli html maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants