-
Notifications
You must be signed in to change notification settings - Fork 4.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
Migrate Settings Screen to React #4323
Conversation
</Menu> | ||
<div className="p-15"> | ||
<div> | ||
<WrappedComponent {...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.
Very nice 👍
Haven't you thought about implementing this not as HOC, but as a regular component and then use it to wrap a return value in render()
functions where needed. Like:
function SettingsScreen({ children }) {
return (
<div className="settings-screen">
...
{children}
</div>
);
}
// Later in other components:
class DataSourcesList extends ReactComponent {
...
render() {
return (
<SettingsScreen>
(Everything that was here before)
</SettingsScreen>
);
}
}
I don't mean that there's something wrong with your solution, just wondering why you decided to implement this as HOC 🙂
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 did think about it, my reason was to centralize the "registration" of settings tabs in one place (which ended up not being as much as I initially thought 😅 - just a settingsMenu.add
removed from each component).
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.
Yeah, I didn't notice that first, but now I see. Very cool, I like it 👍
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 the same thought as @kravets-levko :)
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.
What I first had in mind was to move the routing part to the HOC function as well, but ended up moving only the settingsMenu.add
. Anyway, it seemed to make sense to have this logic centralized in there, so I didn't bother to change.
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 is no much sense to do anything with routing until we replave angular-router
with React alternative. And even in this case routing should not be coupled with this settings screen HOC. So I think it's good that you decided to not change routing part here
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.
@import '~antd/lib/menu/style/index'; | ||
|
||
.settings-screen { | ||
.@{menu-prefix-cls} { |
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 don't think this should be scoped to this page only. Our tabs should have the same look everywhere (unless it makes sense to have a different look in a specific component).
Btw, I said it needs to be consistent, but I didn't say to which direction :-) We can also make the vertical tabs consistent with the horizontal tabs. I think right now they still use bootstrap classes/components, we can try and switch them to Ant component.
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 like variant 2 🙂
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.
You mean migrate the vertical tabs? Me too :)
Then let's revert the color change here and have a separate task of migrating the vertical tabs? It's a single place for all the list pages, right?
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 went with "this page only" approach because it was the valid one in this scope, but let's discuss the second option in #4338, then we come back here :)
Updated with #4338. One thing to notice is that Antd vertical menu has a light blue background while the horizontal one doesn't. |
Because horizontal one is Tabs component and vertical one is Menu. I don't know if that background is an issue, but it's easy to fix it by adding a bit of css to remove that blue background (only for that sidebar component). |
@kravets-levko they are actually all the Menu component :)
For Tabs you are supposed to have the content rendered in page and for Menu
you can use links
|
Ooops 😇 |
redash/client/app/components/admin/Layout.jsx Lines 14 to 26 in 6716bb3
|
Yep, that would've worked. In any case I don't see an issue with the blue bg as well. |
👍 |
What type of PR is this? (check all applicable)
Description
Migrate Settings Screen to React
Related Tickets & Documents
--
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
Will add in a minute :)