Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Add a isWrapped option to display the source of a child in case of HOC. #127

Closed
wants to merge 1 commit into from
Closed

Add a isWrapped option to display the source of a child in case of HOC. #127

wants to merge 1 commit into from

Conversation

darioghilardi
Copy link

@darioghilardi darioghilardi commented Dec 23, 2016

Sometimes the component you want to display in the storybook is exported together with its higher order component. That's the case when you use the injectSheet functionality of JSS for example.
In that case, the "Story Source" that is displayed using this plugin is probably not what you want, for example the output might be:
<Jss(Button) text="Lorem ipsum" />

This PR includes an additional boolean option called isWrapped. When it's true, it extracts the wrapped component source instead of the HOC. According to the previous example the result will be:
<Button text="Lorem ipsum" />

I am not sure this PR is generic enough to be accepted for this addon, I will wait for your feedbacks.
Thanks for this addon and for storybook project.
Awesome work!

@mthuret
Copy link
Contributor

mthuret commented Apr 8, 2017

@darioghilardi I actually encountered this problem myself. You're right is very specific, but in the same time, it could be useful for some cases.
What happen if you have multiple wrapper around your base component with your feature?

@ndelangen
Copy link
Contributor

Hey @darioghilardi

Thank you so much for this PR! We're moving over to a mono-repo, since that makes a lot of sense for a project like this.
We would ❤️ it if you could create a PR here: https://github.com/storybooks/storybook

That'd be awesome, thanks!

@ndelangen ndelangen closed this Apr 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants