-
-
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
Addon-docs: Expand/collapse prop table entries by their 'parent' #7943
Comments
Great idea. I think there are a few aspects to this:
|
this thread might be interesting https://stackoverflow.com/questions/5859561/getting-the-closest-string-match . |
I can see how this would be necessary for composite components. Question:
Some strawman UI ideas:
|
@domyen very good points.
|
@domyen - do you have some animated expand/collapse (ie https://github.com/Stanko/react-animate-height) in sb.components or sds? |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
@atanasster what do you think of the expand/collapse pattern below? Note how the child rows are indented to reflect the parent-child relationship. |
Looks great @domyen and the indentation is very user friendly , just a reminder to possibly default expand the first interface. |
@domyen @atanasster I like the design you propose, with:
I think this can use the sections API of PropsTable: export interface PropsTableSectionsProps {
sections?: Record<string, PropDef[]>;
expanded?: [string];
} If expanded is provided, it will make the rows expandable/collapsible, with the provided sections expanded by default. The other props tables (Vue, Angular, WC, etc.) won't provide expanded, so their behavior shouldn't change. |
Sounds good @shilman |
@shilman @domyen -
|
That makes sense to me! We do that in the animated gif in the column beside the name ("1 remaining unreviewed") – could do the same thing here. |
@atanasster At this point it would be hard to fit into 5.3, but would be happy to merge it as soon as the release goes out! |
@shilman - I did some further tests: adding very simple component
results in *260+ properties (quite disturbing), here is a screenshot: Also an unfortunate finding is that So we would have to first change the loader to https://github.com/atanasster/webpack-react-docgen-typescript which does carry the parent property is we can differentiate where the property belongs: |
I hope this makes sense but in short without adding the |
Sorry to jump in like that. Is there value in rendering the props from native JSX components? Wouldn’t it be easier to exclude those props? This is what I was planning to do when I get back from vacation. |
@patricklafrance - the more (fedback) the merrier :) Can you please elaborate what you had in mind already? |
@patricklafrance I looked at your use case. IMHO that's a (typescript, even though Here is a button example of what I encountered: |
What I have in mind is implemented in the storybook config of cra-ts-kitchen-sink |
I am not sure I understand - the cra-ts-kitchen-sink Button component is not really representative:
You can pass only two props to the |
That might be a different use case then! I haven’t use typescript much (and I am on my phone), I might not understand correctly the problem you are solving here. For the Button component in cra-ts-kitchen-sink, Before the props filter had been configured on the typescript loader about 200 props from the React FC interface were rendered. |
@patricklafrance - you mean the code that says Currently not working :)
IMHO opinion we do need to support combined props - its not just Lets talk more when you are back from vacation, and if you come around Tampa, give me a shout out :) |
Btw the filter above would work with my |
Haha it end up working after updating the library, forgot to remove the comment :) Sounds good! |
strange, its still an open issue on Just tested on the latest cra-ts-kitchen-sink, and the cra preset doesn't seem to work to show any props at all :( I don't see any component in cra-ts-kitchen-sink using JSX.IntrinsicElements that would generate 200 properties - when you are back from vacation would love to get our information merged :) |
aaah, I see - the filter by parent on |
How would I enable this feature? |
We've just released zero-config typescript support in 6.0-beta. Please upgrade and test it! Thanks for your help and support getting this stable for release! |
the typescript prop tables can often times get very long with components that are accepting props from many interfaces. Example:
the prop table in this case is really long:
https://atanasster.github.io/grommet-controls/?path=/docs/controls-input-dropinput--main
The example prop table json file:
https://github.com/atanasster/grommet-controls/blob/master/src/components/DropInput/doc/DropInput.json
A screenshot how the parent interface name can be collapsed. By default suggestion is to have expanded only the first interface name:
The text was updated successfully, but these errors were encountered: