-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Feat: Component Metadata #435
Conversation
@sapegin So should I throw away render + filter and keep the metadata parser step or would you say everything including metadata should plugins? |
I’d keep the metadata reader without special treatment for tags. And any input on plugins API is very much appreciated ;-) It’s still planned because nobody really knows what to do ;-) |
Should I merge it or you’re planning to do something else in this PR? |
I'd like to add some tests for some filled metadata object if possible. I haven't had enough time to do this yet. I'll let you know when I'm done. |
Sounds good ;-) |
@sapegin Done. Should we add further documentation of this feature? Currently it's only documented via the customised sample application (and by the unit tests). Should we add further documentation for users? Maybe you can add documentation because you know best where to put it. Besides that the PR is ready to merge. :) |
Thanks, I’ll add some docs later ;-) |
Metadata
This PR allows to add metadata to components.
Each component, e.g.
Button
, can have an additional file namedcomponentName + '.json'
, e.g.Button.json
, which defines an object that includes metadata for the component.Metadata can be fully controlled by the users with two constrains:
tags
is reserved for the tag-system described belowMetadata of the component is read by
processComponent
and passed to all renderer components, such that users can re-use their own metadata definitions in custom implementations of the renderer components. This gives the users a large flexibility in order to categorise or further describe components.Tag system(won't be implemented)This PR also implements a tag system. The
tags
-keyword in the metadata of a component must be an array of strings. Each tag describes the component and can be used when filtering components.Say we have the following metadata information for
Button
:Button.json
The list of tags is rendered for each component by the
ReactComponentRenderer
.Also the implementation for filtering components has been adjusted to take care of the tag information provided in the metadata. Filtering for
atom
yieldsButton
as a result because it has been tagged as such.TODO
Provide list and list-item renderer for tag list and use them inReactComponentRenderer
Provide styling for list and list-item rendererAdd tests for tag support