-
Notifications
You must be signed in to change notification settings - Fork 370
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
refactor: [M3-6934] MUI v5 Migration - SRC > Features > Linodes
pt 1
#9445
Conversation
@@ -290,16 +266,11 @@ export const RebuildFromStackScript = (props: Props) => { | |||
resetSelectedStackScript={resetStackScript} | |||
selectedId={ss.id} | |||
selectedUsername={ss.username} | |||
updateFor={[classes, ss.id, errors]} |
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.
Since classes was just a Record<classes from the makeStyles, string> after the tss codemod (and just a ClassNameMap before), I think removing them from here should be ok? Seems like it was being checked in the renderGuard 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.
Yes that's fine
return ( | ||
<TableRow | ||
ariaLabel={label} | ||
className={classes.bodyRow} | ||
data-qa-linode={label} | ||
data-qa-loading | ||
key={id} | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} |
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 giving some context on why I made this change: Instead of having the parent component control the state of it's child using very specific css selectors (see LinodeRow.style.ts
), I believe the component itself should be responsible for it's own state changes. By passing down an isHovered
prop, the child component can toggle the copy icon itself.
className={`${classes.row} ${showAll && classes.multipleAddresses}`} | ||
key={key} | ||
<StyledRenderIPDiv | ||
{...handlers} |
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.
Same goes for this, see my comment here. In this case, we're conditionally applying the handlers since we only need them if showTooltipOnIpHover
is true
@@ -0,0 +1,14 @@ | |||
import Grid from '@mui/material/Unstable_Grid2'; |
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.
saw that a lot of files had the same styling for a component, so I created a separate 'common' styling file for the package -- would this be fine? or is there another approach?
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.
@coliu-akamai Yes! We need to do this
sx={{ tooltip: { maxWidth: 300 } }} // ??? | ||
// classes={{ tooltip: classes.maintenanceTooltip }} |
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.
is this feasible? unsure if this is the correct way to get the same behavior
@@ -200,12 +209,12 @@ export const RenderFlag: React.FC<{ | |||
* or if it has a pending mutation available. Mutations take | |||
* precedent over notifications | |||
*/ | |||
const { classes, linodeNotifications, mutationAvailable } = 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.
removed classes from the RenderFlag props, as it seemed it wasn't being used anyway (classes.flag was not a thing in the linode row styles anyway)
@@ -158,6 +127,8 @@ const LinodeNetworking = () => { | |||
}; | |||
|
|||
const renderIPRow = (ipDisplay: IPDisplay) => { | |||
// TODO: in order to fully get rid of makeStyles for this file, may need to convert this to a functional 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.
Tried converting to styled componets/sx for components with classes.row and classes.copy, but this led to some styling behavior at first being lost. Possible solution to fully get rid of makestyles would likely be very similar to the stuff done in IPAddress.tsx/LinodeRow.tsx
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.
Nice improvements and updates
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.
Styles look good to me! 🎨
#9445) * refactor [m3-6272] begin using codemod * refactor [m3-6272] continue switching to tss react * codemod to LinodesDetail * refactor [m3-6272] migrate linode create styles * IPAddress test difficulties * fix some styling * some more ip styling but some weird things going on * narrowing down a source of styling pain * need to look into this IP test * testing ip address * converting to styled components or sx * more style conversions * Improve linode ip address tooltip * Fix focus * rest of styling * it was not the rest of styling * cleanup of styling * fix up styling * Added changeset: MUI v5 Migration > SRC > Features > Linodes Pt 1 * all styles converted(except one file, see pr comment), for real this time --------- Co-authored-by: Jaalah Ramos <[email protected]>
#9445) * refactor [m3-6272] begin using codemod * refactor [m3-6272] continue switching to tss react * codemod to LinodesDetail * refactor [m3-6272] migrate linode create styles * IPAddress test difficulties * fix some styling * some more ip styling but some weird things going on * narrowing down a source of styling pain * need to look into this IP test * testing ip address * converting to styled components or sx * more style conversions * Improve linode ip address tooltip * Fix focus * rest of styling * it was not the rest of styling * cleanup of styling * fix up styling * Added changeset: MUI v5 Migration > SRC > Features > Linodes Pt 1 * all styles converted(except one file, see pr comment), for real this time --------- Co-authored-by: Jaalah Ramos <[email protected]>
#9445) * refactor [m3-6272] begin using codemod * refactor [m3-6272] continue switching to tss react * codemod to LinodesDetail * refactor [m3-6272] migrate linode create styles * IPAddress test difficulties * fix some styling * some more ip styling but some weird things going on * narrowing down a source of styling pain * need to look into this IP test * testing ip address * converting to styled components or sx * more style conversions * Improve linode ip address tooltip * Fix focus * rest of styling * it was not the rest of styling * cleanup of styling * fix up styling * Added changeset: MUI v5 Migration > SRC > Features > Linodes Pt 1 * all styles converted(except one file, see pr comment), for real this time --------- Co-authored-by: Jaalah Ramos <[email protected]>
Description 📝
Part of migrating SRC > Features > Firewalls from MUI v4 to v5 -- breaking this PR up since there will be a lot of files. This specific pr is for styling changes: running the codemod, and then converting styles to styled components / sx if possible.
There will be a later PR for fixing up imports/exports, etc later
Major Changes 🔄
Preview 📷
How to test 🧪