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
Nested overrides playground #3940
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/uber-ui-platform/baseweb/lvaumb46b |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6c149a0:
|
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.
Works well for this particular nested override. Feel free to ignore the comment I made until a later pr
{overrideKey} | ||
{nested ? ( | ||
<NestedTooltip | ||
name={componentName} |
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.
There are some nested overrides that don't have the same key as the component name. For example there are multiple 'Select' components in the datepicker. May need to add some key value pair in the config file
https://github.com/uber/baseweb/blob/master/src/datepicker/types.js#L29
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.
for that case it should be enough to do
overrides: {
custom: {
names: [
'Root',
{...TagConfig, componentName: 'TagRenamed' }
if not, will come up with some different fix later
this is really cool 👏 |
This PR adds support for nested overrides into our interactive playground and makes the whole UI more condensed:
Features
nested
tooltip you can hover over and get more info.Before, the
names
could be only strings. Now, it can be also a component configuration to represent the nested override.return {}
to limit code nesting (as you can see in the screenshot). There was actually a bug in@babel/generator
that did not correctly parenthesized returning object of the arrow function() => ({})
and resulted in syntax error. Fortunately, it was recently fixed so that's the only reason whyreact-view
needed to be bumped.