Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-47663 : Test out MUI for menu components POC #11521

Closed
wants to merge 82 commits into from
Closed

Conversation

M-ZubairAhmed
Copy link
Member

@M-ZubairAhmed M-ZubairAhmed commented Nov 3, 2022

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


@hmhealey
Copy link
Member

@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

Copy link
Contributor

@michelengelen michelengelen left a 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! :shipit:

Comment on lines 62 to 64
if (e.stopPropagation) {
e.stopPropagation();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (e.stopPropagation) {
e.stopPropagation();
}
e.stopPropagation?.();

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Contributor

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

components/channel_move_to_submenu/index.tsx Outdated Show resolved Hide resolved
components/channel_move_to_submenu/index.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,26 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
Copy link
Contributor

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!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didnt understand sorry.

Copy link
Contributor

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

Copy link
Member Author

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/menu/index.ts Outdated Show resolved Hide resolved
components/menu/menu_item.tsx Outdated Show resolved Hide resolved
components/menu/menu_item.tsx Show resolved Hide resolved
components/menu/sub_menu.tsx Outdated Show resolved Hide resolved
components/channel_move_to_submenu/index.tsx Show resolved Hide resolved
components/channel_move_to_submenu/index.tsx Outdated Show resolved Hide resolved
};

return (
<CompassDesignProvider theme={props.theme}>
Copy link
Member

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

Copy link
Member Author

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. 🤔

Copy link
Member

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?

Copy link
Contributor

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.

components/menu/menu.tsx Outdated Show resolved Hide resolved
@@ -274,8 +274,6 @@ export default class SidebarCategory extends React.PureComponent<Props, State> {
categoryMenu = (
<SidebarCategoryMenu
category={category}
isMenuOpen={this.state.isMenuOpen}
onToggleMenu={this.handleMenuToggle}
Copy link
Member

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

components/menu/index.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@@ -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',
Copy link
Member

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

Copy link
Member Author

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/

Copy link
Member

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.

CC @michelengelen

@M-ZubairAhmed
Copy link
Member Author

will be handled in separate individual prs. thanks everyone.

@mattermod mattermod removed the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Dec 4, 2022
@M-ZubairAhmed M-ZubairAhmed deleted the MM-47663-b branch December 4, 2022 13:56
@mm-cloud-bot
Copy link

Test server destroyed

1 similar comment
@mm-cloud-bot
Copy link

Test server destroyed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants