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 customItemsRenderer prop #152

Merged
merged 4 commits into from
Jan 26, 2021
Merged

Conversation

yegor-babiy
Copy link
Contributor

@yegor-babiy yegor-babiy commented Jan 25, 2021

We extends from BaseList in hierarchical_select
It's different way to drilling props
In the react-tree it's native div tag.
That's why was added customItemsRenderer
image

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @kenshooui/react-tree@0.0.20-canary.152.423.0
npm install @kenshooui/material-tree@0.0.3-canary.152.423.0
# or 
yarn add @kenshooui/react-tree@0.0.20-canary.152.423.0
yarn add @kenshooui/material-tree@0.0.3-canary.152.423.0

</Items>
{customItemsRenderer ? (
React.cloneElement(customItemsRenderer, {
...props,
Copy link
Contributor

@liorheber liorheber Jan 25, 2021

Choose a reason for hiding this comment

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

I'm not sure we should just pass the props (I'm talking about ...props), the props are meant for tree.
As any custom renderer, you can OTHER props externally when you do something like

<Tree customItemsRenderer=<MyRenderer someProp={} />

Unless you mean yo pass something like

<Tree customItemsRenderer={someRenderer}/>

In which case you also need to create the component in the tree and you can still pass props using something like

<Tree customItemsRenderer={() => <SomeRenderer .../>}/>

Hope my comment is understandable.

Comment on lines +110 to +111
forwardIconRenderer={forwardIconRenderer}
selectedItem={selectedItem}
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't want to pass these two?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as I see selected Item we pass externally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ForwardIconRenderer the same

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's important we maintain the same API.
IT would be very confusing if the icons work in one instance but if you pass a custom list they don't.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a ping on this so that we can merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@liorheber
Copy link
Contributor

Don't forget to update the readmes

@yegor-babiy
Copy link
Contributor Author

Is it manually change? or we have specific tool for readme generation?

@liorheber
Copy link
Contributor

Unfortunately manual at this point.

@liorheber liorheber merged commit 2fe2704 into master Jan 26, 2021
@liorheber liorheber deleted the add_custom_items_renderer_prop branch January 26, 2021 17:04
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