Skip to content
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

Add filtering prop table docs and examples #169

Merged

Conversation

lonyele
Copy link
Collaborator

@lonyele lonyele commented May 19, 2019

Hi, It is a follow up of #163. I added more examples and it usages or behaviours on propTables.
I found that this propTable feature is little bit tricky because of how react-docgen or prop-types works.
Hopefully this looks fine(please let me know if anything should be changed)

@lonyele
Copy link
Collaborator Author

lonyele commented May 19, 2019

btw once these are acceptable, I would copy to vue, html example.

I think this propTable and filteringPropTable feature is almost useless on HOC and RenderProp usages. Part of it is because of the data it gets from storybook lacks needed datas(sometimes no docgen info) and part of it is because of the nature of its usage. I thought filtering propTables was ok, but now I think it is not enough.

What do you think on actually adding whatever propTables through includePropTables? For now it only includes propTables of components that are specified in specific story.

@tuchk4
Copy link
Owner

tuchk4 commented May 19, 2019

I would like to try to fit all users needs, and also to keep api as simple as possible.

feature is almost useless on HOC and RenderProp usages.

It is useful if propTypes correctly defined for docgen :)

@tuchk4 tuchk4 self-requested a review May 19, 2019 22:48
@lonyele
Copy link
Collaborator Author

lonyele commented May 20, 2019

Hm... I tried copying example-react to the example-vue, but it throws babel errors and general project structure is little bit different than react(different dependencies) About example-html, it doesn't really have stories. Maybe I should not copy and paste it?

Yes, only if we can get a docgen correctly...(sad that what I implemented is useless here...) However for the case of HOC and RenderProps pattern, even if we get the docgen properly, still there is no way to show the main component's propTable(Not a wrapper component such as HOC, RenderProp components, but a actual components that are enhanced by them)

I think user wants to see the propTable of enhanced component. To make this happen, I think changing the logic of includePropTables to not only filter but also add propTables is needed. Currently we filter propTables, but for these cases, we need to add it. I'm thinking of using react-docgen(same as storybook) to manually extract propTables that are not specified at a story and put it into propTables list.

@lonyele lonyele merged commit d808ce2 into tuchk4:master May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants