MM-47663 : Test out MUI for menu components POC #11521
Conversation
@M-ZubairAhmed Could you rebase this branch to sort out the conflicts and duplicate commits? I think that'd probably be the easiest way to fix at least the duplicated commits |
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.
just a few comments from my side ... looking very solid so far! Nice work!
components/at_mention/at_mention.tsx
Outdated
if (e.stopPropagation) { | ||
e.stopPropagation(); | ||
} |
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.
if (e.stopPropagation) { | |
e.stopPropagation(); | |
} | |
e.stopPropagation?.(); |
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'm actually confused about why we need this here at all since e.stopPropagation
should always be defined based on the type definition. Is the type definition perhaps incorrect?
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 is not part of my pr. But the base react 17 pr.
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 was confused as well. especially when using the built in React change handler type definitions this is typically very well typed. Could be a remnant of the past though! :D
@@ -0,0 +1,26 @@ | |||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. |
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.
could we add TODO comments (maybe TODO@LosTigres: ...
) so that we can filter out which components we can replace once we reach a point with the component effort where this is possible? That would really help a lot!
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 didnt understand sorry.
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.
OK, maybe you are not aware of it, but we are currently restarting the effort of building a component library ... this time it will be based on Material UI and since we will handle a lot of components with this it would be great to know which components got recently added that mimik that compass design look and feel so we can start replacing those once we reach a point where we have a sufficient amount of components ready
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.
@michelengelen i meant where do you want the todo comment to be and what it should include?
components/sidebar/sidebar_category/sidebar_category_menu/sidebar_category_menu.tsx
Show resolved
Hide resolved
fix in middle
components/menu/menu.tsx
Outdated
}; | ||
|
||
return ( | ||
<CompassDesignProvider theme={props.theme}> |
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.
Do we need to target individual menus with this? I would've thought that we'd wrap the whole app in this similar to how we do the react-intl context
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 have tried that but somehow the context of provider placed in root is not reaching way down in the 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 wonder if it's similar to the old OverlayTrigger
that doesn't pass context down properly any more. Is it just submenus that it doesn't properly apply to?
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.
Its strange that it does not pass it down. I wonder what could be hindering it from doing so. Would you mind trying to add this to the routing level? The last time I checked that was the place where I tried to add it and it worked.
@@ -274,8 +274,6 @@ export default class SidebarCategory extends React.PureComponent<Props, State> { | |||
categoryMenu = ( | |||
<SidebarCategoryMenu | |||
category={category} | |||
isMenuOpen={this.state.isMenuOpen} | |||
onToggleMenu={this.handleMenuToggle} |
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 noticed the styling for this component changes when the menu is open. Is that something we'll need to worry about with this? It's possible that extra CSS class that's applied is for dealing with overflow though which we shouldn't have to do anymore
@@ -247,6 +247,7 @@ var config = { | |||
'mattermost-redux/test': 'packages/mattermost-redux/test', | |||
'mattermost-redux': 'packages/mattermost-redux/src', | |||
reselect: 'packages/reselect/src', | |||
'@mui/styled-engine': '@mui/styled-engine-sc', |
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.
Why do we need an alias for this? I would've expected this to just work out of the box without any sort of import aliasing
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 material ui works out of box for emotion-css. To make it work with styled components we need this alias. https://mui.com/material-ui/guides/styled-engine/
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.
Hopefully this won't break when we start to using the components package elsewhere. We'll probably need to look at how Babel handles this, but that can be done later when we move this into the components package.
will be handled in separate individual prs. thanks everyone. |
Test server destroyed |
1 similar comment
Test server destroyed |
Summary
Since material-ui has peer dependency on react-17, the base commits have been rebased from react 17 upgrade pr. Actual work on the pr starts from these commits
Ticket Link
https://mattermost.atlassian.net/browse/MM-47663
Related Pull Requests
Has changes from #10836
Screenshots
Release Note