-
Notifications
You must be signed in to change notification settings - Fork 1
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
DT-1152: Migrate Components from @mui/styles #1751
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
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.
LGTM pending the conversations about theme. I really would love to make that better, but maybe we do it the way that works right now and then file a follow up?
<Button | ||
variant="contained" | ||
color="primary" | ||
disableElevation | ||
disabled={!isEmail(addEmailInput) && !_.some(usersToAdd, (user) => isEmail(user))} | ||
className={clsx(classes.button, classes.section)} | ||
sx={{ | ||
backgroundColor: 'common.link', |
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 one is borderline. It only has three properties, but it also has the hover logic? What do you think about pulling this out?
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.
That would totally be reasonable to pull it into a styled component.
The approach I took with my PR was just to go with whichever option (sx or styled) copilot picked. Especially for cases where a selection is borderline, I would like to defer to copilot's pick mostly to help expedite these PRs. We can always revisit a given pick if we're working with a component in the future.
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 happy with the current approach, and I think once more components are converted, we'll have a better handle on how to generify this to handle more cases. For instance, our CustomTheme
+ useTheme()
approach did not work in TextContent.jsx
due to the span
as an argument to styled
.
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.
LGTM! Thank you!
I think we can make a new ticket to look into a more sharable theme util and do that in the future.
Addresses
https://broadworkbench.atlassian.net/browse/DT-1152
Summary
For each component, followed the following process:
styled
from'@mui/material/styles';
instead of'@mui/system';
. Copilot doesn't catch that.props
is the passed in function argument and destructure on a separate line in the function. This helps avoid areadonly
warning.readonly
modifiers// @ts-ignore
where necessary. I found that we needed to do this for a variety of theme-related fields.Other notes:
Failure.jsx
is unused, but I'm not aware of the history for this so it is included as part of the migration.InfoModal
- Need some guidance on how to find where this is in use.TextContent
is visible on all tablesAddUserAccess
FullViewSnapshotButton
LoadingSpinner
Screen.Recording.2025-02-11.at.7.28.44.AM.mov
TabPanel, TabWrapper
Screen.Recording.2025-02-11.at.7.30.04.AM.mov
TerraTooltip