-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
priyankar205
commented
Nov 15, 2018
- Implemented the Tree component including the Teams theme
- Work Left: Support for other themes. Implement accessibility props.
@layershifter could you please take a look at this component structure and API? |
…s in shorthand property
docs/src/examples/components/Tree/Types/TreeExample.shorthand.tsx
Outdated
Show resolved
Hide resolved
docs/src/examples/components/Tree/Types/TreeExample.shorthand.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have couple of questions that I would like to clarify:
- could you, please, suggest how it would be possible to pass some arbitrary content as tree's child (other than just plain
string
), like in the following case:
items: [
<span dir='auto'>Hello from component!</span>,
<span>for more info, click <button>here</button>
]
The only way how it could be achieved now seems to be the following:
items: [
{
title: <span dir='auto'>Hello from component!</span>
},
{
title: <span>for more info, click <button>here</button>
}
This syntax is quite verbose for achieving this simple task. Note that this problem might be alleviated by passing title
property as a default one for TreeItem
component:
TreeItem.create = createShorthandFactory(TreeItem, 'title')
- second question is about this line (and related comment): https://github.com/stardust-ui/react/pull/479/files#diff-560cfd0141d58538f8a5e7845f4ab0aeR84 (about the fact that there is no
content
prop defined forTree
component, but this one is used in a shorthand). Could you, please, suggest what is a resolution suggested for it?
Thank you!
@kuzhelov : I agree to your first point. I will update the code to |
src/components/Tree/Tree.tsx
Outdated
...childrenComponentPropTypes, | ||
accessibility: PropTypes.func, | ||
items: customPropTypes.collectionShorthand, | ||
nested: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this prop seems to be not used anywhere - am I missing something (please, just reference the line in code in that case)? Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had added a class. Got deleted in refactoring perhaps. Also it might be needed for accessibility props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, if it is not used anywhere now, lets delete it - even if it will be used for accessibility later, we will add it. Lets limit the API to only those things that are necessary
@priyankar205 While I totally agree that <ul>
<li> <span>I am not just a string</span> <li>
<li> Me neither, click here if you disagree: <button>Disagree!</button> </li>
</ul> So, to me it seems that current implementation is unable to handle these cases - in a sense, as I've already mentioned before, client will need to provide this content as a value for Thank you! |
@kuzhelov We can handle these cases with the renderItemTitle function for now as in the second example. Also I see that other components like List also fail to handle these cases directly. |