-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make results of <Props> iterable #1375
Comments
Could you post an example? I traced Props output, and I can see rows are wrapped, and I can't manipulate them. |
Could you add a use case example? When would you need to filter this way?
You must shadow the component (meaning that you need to create a import { Props as DoczProps } from 'docz'
export const Props = ({ props, ...others }) => {
const displayedProps = props.filter(propRow => propRow.componentName === 'UiComponent'))
return <DoczProps props={displayedProps} {...others} />
}
I have no idea for the injection of meta data as I don't know the project enough but filtering by component use sounds like a valid case. @rakannimer might have an idea about this part. What you want to do currently, if I understand correctly, is to not change the rendered element (you still want the Table from As of how would we do it, I think that Another way would be: <Props of={Component} filter={propRow => propRow.componentName === 'UiComponent')}/> |
@mickaelzhang the use case — I want split props into groups for every component in my UI lib. It looks I can do that with the HOC, I will try to do so and post update. as for injecting, I think it could be something like this: const row = <div>ya-da</div>;
return Object.assign(row, someProps); |
@droganov Correct me if I'm wrong but if you must split into group all your component in your UI lib, then you case is similar to mine? Then shadowing the Props component of the docz theme is probably better for you With the solution that you propose you would need to filter everytime you use |
Yes, basically what I want is inserting a component name.
Will try it in a day or so.
…On Tue, 4 Feb 2020, 15:52 Mickael Zhang, ***@***.***> wrote:
@droganov <https://github.com/droganov> Correct me if I'm wrong but if
you must split into group all your component in your UI lib, then you case
is similar to mine? Then shadowing the Props component of the docz theme is
probably better for you
With the solution that you propose you would need to filter everytime you
use <Props />, with the shadowing you would just filter it once
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1375?email_source=notifications&email_token=AAKPYQ66JGR7IGN5ACGKB6TRBEUGDA5CNFSM4KOGRDQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKW2C3Y#issuecomment-581804399>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKPYQ7CDFBHQ7ACWLWI73TRBEUGDANCNFSM4KOGRDQA>
.
|
Any news on this @droganov? |
@mickaelzhang I'm sorry, I could'n do it fast. |
I'll close this issue for now @droganov, the current solution in place in Feel free to reopen a PR later if needed :) |
Branched from #1371 (comment)
I suggest to change
<Props>
so it would accept function child and that child could be used to manipulate rendered rows.We also need to inject metadata (component name and path) as a static members, to make that manipulate meaningful
The text was updated successfully, but these errors were encountered: