-
Notifications
You must be signed in to change notification settings - Fork 361
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-6421 & M3-6422] β MUI v5 Migration - Components > TypeToConfirm
& Components > TypeToConfirmDialog
#9124
Changes from 3 commits
516b2fb
f4bd256
d19b7fa
c61c335
fd1383e
f48e2ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tech Stories | ||
--- | ||
|
||
MUI v5 Migration - `Components > TypeToConfirm & Components > TypeToConfirmDialog` ([#9124](https://github.com/linode/manager/pull/9124)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import { styled } from '@mui/material/styles'; | ||
import * as React from 'react'; | ||
import { makeStyles } from '@mui/styles'; | ||
import { Theme } from '@mui/material/styles'; | ||
import Typography from 'src/components/core/Typography'; | ||
import Link from 'src/components/Link'; | ||
import TextField from 'src/components/TextField'; | ||
import Typography from 'src/components/core/Typography'; | ||
|
||
export interface Props { | ||
export interface TypeToConfirmProps { | ||
confirmationText?: JSX.Element | string; | ||
onChange: (str: string) => void; | ||
label: string; | ||
|
@@ -20,13 +19,7 @@ export interface Props { | |
[propName: string]: any; | ||
} | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
description: { | ||
marginTop: theme.spacing(), | ||
}, | ||
})); | ||
|
||
const TypeToConfirm: React.FC<Props> = (props) => { | ||
export const TypeToConfirm = (props: TypeToConfirmProps) => { | ||
const { | ||
confirmationText, | ||
onChange, | ||
|
@@ -40,8 +33,6 @@ const TypeToConfirm: React.FC<Props> = (props) => { | |
...rest | ||
} = props; | ||
|
||
const classes = useStyles(); | ||
|
||
/* | ||
There was an edge case bug where, when preferences?.type_to_confirm was undefined, | ||
the type-to-confirm input did not appear and the language in the instruction text | ||
|
@@ -67,16 +58,15 @@ const TypeToConfirm: React.FC<Props> = (props) => { | |
</> | ||
) : null} | ||
{!hideInstructions ? ( | ||
<Typography | ||
data-testid="instructions-to-enable-or-disable" | ||
className={classes.description} | ||
> | ||
<StyledTypography data-testid="instructions-to-enable-or-disable"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it better to prefer styled here? I'm a big fan of styling via props, but I don't know what direction we want to prefer for things like this going forward. <Typography
marginTop={1}
data-testid="instructions-to-enable-or-disable"
> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good point. I'm not aware of any comparative benefits to preferring the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one of those components that support system props, so technically it's ok. I bet even |
||
To {disableOrEnable} type-to-confirm, go to the Type-to-Confirm | ||
section of <Link to="/profile/settings">My Settings</Link>. | ||
</Typography> | ||
</StyledTypography> | ||
) : null} | ||
</> | ||
); | ||
}; | ||
|
||
export default TypeToConfirm; | ||
const StyledTypography = styled(Typography)(({ theme }) => ({ | ||
marginTop: theme.spacing(), | ||
})); |
This file was deleted.
This file was deleted.
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.
Unrelated to your PR, but yikes... We should fix this
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.
Here is an untested fix