diff --git a/packages/manager/.changeset/pr-9445-tech-stories-1690571677414.md b/packages/manager/.changeset/pr-9445-tech-stories-1690571677414.md new file mode 100644 index 00000000000..7e09f36566f --- /dev/null +++ b/packages/manager/.changeset/pr-9445-tech-stories-1690571677414.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Tech Stories +--- + +MUI v5 Migration > SRC > Features > Linodes Pt 1 ([#9445](https://github.com/linode/manager/pull/9445)) diff --git a/packages/manager/src/features/Linodes/CloneLanding/CloneLanding.tsx b/packages/manager/src/features/Linodes/CloneLanding/CloneLanding.tsx index 1cc5e0db4f2..e6322243789 100644 --- a/packages/manager/src/features/Linodes/CloneLanding/CloneLanding.tsx +++ b/packages/manager/src/features/Linodes/CloneLanding/CloneLanding.tsx @@ -6,8 +6,7 @@ import { } from '@linode/api-v4/lib/linodes'; import { APIError } from '@linode/api-v4/lib/types'; import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { makeStyles } from '@mui/styles'; +import { styled, useTheme } from '@mui/material/styles'; import { castDraft } from 'immer'; import { intersection, pathOr } from 'ramda'; import * as React from 'react'; @@ -51,36 +50,12 @@ const LinodesDetailHeader = React.lazy( () => import('../LinodesDetail/LinodesDetailHeader/LinodeDetailHeader') ); -const useStyles = makeStyles((theme: Theme) => ({ - appBar: { - '& > div': { - marginTop: 0, - }, - }, - diskContainer: { - marginTop: theme.spacing(4), - }, - outerContainer: { - paddingBottom: theme.spacing(2), - paddingLeft: theme.spacing(2), - paddingRight: theme.spacing(2), - }, - paper: { - padding: `${theme.spacing(3)} ${theme.spacing(3)} 0`, - }, - root: { - marginTop: theme.spacing(1), - }, - title: { - marginBottom: theme.spacing(2), - }, -})); - const CloneLanding = () => { const { linodeId: _linodeId } = useParams<{ linodeId: string }>(); const history = useHistory(); const match = useRouteMatch(); const location = useLocation(); + const theme = useTheme(); const linodeId = Number(_linodeId); @@ -89,8 +64,6 @@ const CloneLanding = () => { const { data: linodes } = useAllLinodesQuery(); const { data: linode } = useLinodeQuery(linodeId); - const classes = useStyles(); - const configs = _configs ?? []; const disks = _disks ?? []; @@ -287,12 +260,12 @@ const CloneLanding = () => { - + - + { -
+ -
+
-
+ You can make a copy of a disk to the same or different Linode. We recommend you power off your Linode first, and keep it powered off until the disk has finished being cloned. -
+
{ selectedConfigIds={selectedConfigIds} />
-
+
@@ -385,4 +358,12 @@ const CloneLanding = () => { ); }; +const StyledOuterDiv = styled('div', { label: 'StyledOuterDiv' })( + ({ theme }) => ({ + paddingBottom: theme.spacing(2), + paddingLeft: theme.spacing(2), + paddingRight: theme.spacing(2), + }) +); + export default CloneLanding; diff --git a/packages/manager/src/features/Linodes/CloneLanding/Configs.tsx b/packages/manager/src/features/Linodes/CloneLanding/Configs.tsx index 7c0e436b8f4..de28452e1b5 100644 --- a/packages/manager/src/features/Linodes/CloneLanding/Configs.tsx +++ b/packages/manager/src/features/Linodes/CloneLanding/Configs.tsx @@ -1,5 +1,4 @@ import { Config } from '@linode/api-v4/lib/linodes'; -import { makeStyles } from '@mui/styles'; import * as React from 'react'; import { Checkbox } from 'src/components/Checkbox'; @@ -13,15 +12,6 @@ import { TableRowEmpty } from 'src/components/TableRowEmpty/TableRowEmpty'; import { ConfigSelection } from './utilities'; -const useStyles = makeStyles(() => ({ - root: { - '& td': { - borderBottom: 'none', - paddingBottom: 0, - paddingTop: 0, - }, - }, -})); export interface Props { configSelection: ConfigSelection; configs: Config[]; @@ -31,8 +21,6 @@ export interface Props { export const Configs: React.FC = (props) => { const { configSelection, configs, handleSelect } = props; - const classes = useStyles(); - return ( {({ @@ -45,7 +33,16 @@ export const Configs: React.FC = (props) => { }) => { return (
- +
{paginatedData.length === 0 ? ( diff --git a/packages/manager/src/features/Linodes/CloneLanding/Details.tsx b/packages/manager/src/features/Linodes/CloneLanding/Details.tsx index 0b88848624d..e4c93cbb9af 100644 --- a/packages/manager/src/features/Linodes/CloneLanding/Details.tsx +++ b/packages/manager/src/features/Linodes/CloneLanding/Details.tsx @@ -1,7 +1,6 @@ import { Disk, Linode } from '@linode/api-v4/lib/linodes'; import Close from '@mui/icons-material/Close'; -import { Theme } from '@mui/material/styles'; -import { makeStyles } from '@mui/styles'; +import { styled, useTheme } from '@mui/material/styles'; import * as React from 'react'; import { Button } from 'src/components/Button/Button'; @@ -22,58 +21,6 @@ import { } from './utilities'; import { Link } from 'src/components/Link'; -const useStyles = makeStyles((theme: Theme) => ({ - clearButton: { - top: `-${theme.spacing(0.5)}`, - }, - closeIcon: { - '& path': { - fill: theme.palette.primary.main, - }, - alignItems: 'center', - backgroundColor: theme.color.white, - border: 'none', - cursor: 'pointer', - display: 'flex', - paddingBottom: 0, - paddingTop: 0, - }, - errorText: { - '& a': { - color: theme.color.red, - textDecoration: 'underline', - }, - color: theme.color.red, - marginTop: theme.spacing(1), - }, - header: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - marginBottom: theme.spacing(2), - }, - labelOuter: { - alignItems: 'center', - display: 'flex', - justifyContent: 'space-between', - width: '100%', - }, - list: { - flexWrap: 'wrap', - justifyContent: 'space-between', - }, - nestedList: { - flexBasis: '100%', - marginLeft: theme.spacing(2), - }, - root: { - padding: theme.spacing(2), - }, - submitButton: { - marginTop: theme.spacing(3), - }, -})); - interface Props { clearAll: () => void; currentLinodeId: number; @@ -111,7 +58,7 @@ export const Configs: React.FC = (props) => { const region = regions?.find((r) => r.id === thisLinodeRegion); - const classes = useStyles(); + const theme = useTheme(); const noneError = errorMap.none; // When duplicating a disk on the SAME Linode, if there's not a enough space, @@ -170,18 +117,18 @@ export const Configs: React.FC = (props) => { const estimatedCloneTime = getEstimatedCloneTime(totalSize, mode); return ( - -
+ + Selected -
+ {noneError && !isNoneErrorActuallyALinodeError && ( @@ -191,22 +138,21 @@ export const Configs: React.FC = (props) => { {selectedConfigs.map((eachConfig) => { return ( -
+ {eachConfig.label} - -
- + + + {eachConfig.associatedDisks.map((eachDisk) => { return ( @@ -223,19 +169,18 @@ export const Configs: React.FC = (props) => { {selectedDisks.map((eachDisk) => { return ( {eachDisk.label} - + ); })} @@ -272,19 +217,19 @@ export const Configs: React.FC = (props) => { /> {linodeError && ( - + {linodeError}{' '} Shrink your existing disks{' '} or{' '} resize your Linode to a larger plan. - + )}
- Label - Size + Label + Size diff --git a/packages/manager/src/features/Linodes/LinodesCreate/AddonsPanel.tsx b/packages/manager/src/features/Linodes/LinodesCreate/AddonsPanel.tsx index 3ab4c6676d5..b1f7e8d18db 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/AddonsPanel.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/AddonsPanel.tsx @@ -1,6 +1,5 @@ import { Interface, Linode } from '@linode/api-v4/lib/linodes'; -import { Theme } from '@mui/material/styles'; -import { makeStyles } from '@mui/styles'; +import { styled, useTheme } from '@mui/material/styles'; import * as React from 'react'; import { Link } from 'react-router-dom'; @@ -21,33 +20,6 @@ import { privateIPRegex } from 'src/utilities/ipUtils'; import AttachVLAN from './AttachVLAN'; import { VLANAccordion } from './VLANAccordion'; -const useStyles = makeStyles((theme: Theme) => ({ - addons: { - marginTop: theme.spacing(3), - }, - caption: { - marginTop: -8, - paddingLeft: `calc(${theme.spacing(2)} + 18px)`, // 34, - [theme.breakpoints.up('md')]: { - paddingLeft: `calc(${theme.spacing(4)} + 18px)`, // 50 - }, - }, - label: { - '& > span:last-child': { - color: theme.color.headline, - fontFamily: theme.font.bold, - fontSize: '1rem', - lineHeight: '1.2em', - [theme.breakpoints.up('md')]: { - marginLeft: theme.spacing(2), - }, - }, - }, - title: { - marginBottom: theme.spacing(2), - }, -})); - export interface AddonsPanelProps { accountBackups: boolean; backups: boolean; @@ -89,7 +61,7 @@ export const AddonsPanel = React.memo((props: AddonsPanelProps) => { vlanLabel, } = props; - const classes = useStyles(); + const theme = useTheme(); const flags = useFlags(); const { data: image } = useImageQuery( @@ -191,8 +163,8 @@ export const AddonsPanel = React.memo((props: AddonsPanelProps) => { vlanLabel={vlanLabel} /> )} - - + + Add-ons{' '} {backupsDisabledReason && ( @@ -204,7 +176,7 @@ export const AddonsPanel = React.memo((props: AddonsPanelProps) => { to use the backup service. )} - { {renderBackupsPrice()} } - className={classes.label} /> - + {accountBackups ? ( You have enabled automatic backups for your account. This Linode @@ -237,9 +208,9 @@ export const AddonsPanel = React.memo((props: AddonsPanelProps) => { are priced according to the Linode plan selected above. )} - + - { onChange={togglePrivateIP} /> } - className={classes.label} label="Private IP" /> @@ -257,6 +227,30 @@ export const AddonsPanel = React.memo((props: AddonsPanelProps) => { ); }); +const StyledTypography = styled(Typography, { label: 'StyledTypography' })( + ({ theme }) => ({ + marginTop: -8, + paddingLeft: `calc(${theme.spacing(2)} + 18px)`, // 34, + [theme.breakpoints.up('md')]: { + paddingLeft: `calc(${theme.spacing(4)} + 18px)`, // 50 + }, + }) +); + +const StyledFormControlLabel = styled(FormControlLabel, { + label: 'StyledFormControlLabel', +})(({ theme }) => ({ + '& > span:last-child': { + color: theme.color.headline, + fontFamily: theme.font.bold, + fontSize: '1rem', + lineHeight: '1.2em', + [theme.breakpoints.up('md')]: { + marginLeft: theme.spacing(2), + }, + }, +})); + const getVlanDisabledReason = ( isBareMetal: boolean, createType: CreateTypes, diff --git a/packages/manager/src/features/Linodes/LinodesCreate/ApiAwarenessModal/index.tsx b/packages/manager/src/features/Linodes/LinodesCreate/ApiAwarenessModal/index.tsx index d5d1f6949b8..f2ed070d0ae 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/ApiAwarenessModal/index.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/ApiAwarenessModal/index.tsx @@ -1,6 +1,5 @@ import { CreateLinodeRequest } from '@linode/api-v4/lib/linodes'; -import { Theme } from '@mui/material/styles'; -import { makeStyles } from '@mui/styles'; +import { useTheme } from '@mui/material/styles'; import React, { useEffect, useMemo } from 'react'; import { useHistory } from 'react-router-dom'; @@ -20,38 +19,6 @@ import { generateCLICommand } from 'src/utilities/generate-cli'; import CodeBlock from '../CodeBlock'; -const useStyles = makeStyles((theme: Theme) => ({ - actionPanelStyles: { - marginTop: '18px !important', - paddingBottom: 0, - paddingTop: 0, - }, - guides: { - marginTop: 16, - }, - modalContent: { - overflowX: 'hidden', - paddingBottom: '0px', - }, - modalIntroTypoClass: { - paddingBottom: '6px', - }, - otherTools: { - fontFamily: theme.font.bold, - fontSize: '14px !important', - fontWeight: 400, - }, - tabDescription: { - marginTop: theme.spacing(2), - }, - tabsContainer: { - paddingTop: theme.spacing(), - }, - tabsStyles: { - marginTop: '14px', - }, -})); - export interface Props { isOpen: boolean; onClose: () => void; @@ -62,7 +29,7 @@ export interface Props { const ApiAwarenessModal = (props: Props) => { const { isOpen, onClose, payLoad, route } = props; - const classes = useStyles(); + const theme = useTheme(); const history = useHistory(); const { events } = useEvents(); @@ -108,14 +75,17 @@ const ApiAwarenessModal = (props: Props) => { return ( - + Create a Linode in the command line using either cURL or the Linode CLI — both of which are powered by the Linode API. Select one of the methods below and paste the corresponding command into your local terminal. The @@ -123,14 +93,14 @@ const ApiAwarenessModal = (props: Props) => { the Cloud Manager create form. - + Most Linode API requests need to be authenticated with a valid{' '} @@ -207,7 +177,13 @@ const ApiAwarenessModal = (props: Props) => { - + Deploy and manage your infrastructure with the{' '} @@ -237,13 +213,13 @@ const ApiAwarenessModal = (props: Props) => { ); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/AppPanelSection.tsx b/packages/manager/src/features/Linodes/LinodesCreate/AppPanelSection.tsx index ee6cae68e97..1a49a165f34 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/AppPanelSection.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/AppPanelSection.tsx @@ -9,12 +9,6 @@ import { Divider } from 'src/components/Divider'; import { Typography } from 'src/components/Typography'; import SelectionCardWrapper from 'src/features/Linodes/LinodesCreate/SelectionCardWrapper'; -const AppPanelGrid = styled(Grid)(({ theme }) => ({ - marginBottom: theme.spacing(), - marginTop: theme.spacing(2), - padding: `${theme.spacing(1)} 0`, -})); - interface Props { apps: StackScript[]; disabled: boolean; @@ -96,4 +90,10 @@ export const AppPanelSection: React.FC = (props) => { ); }; +const AppPanelGrid = styled(Grid)(({ theme }) => ({ + marginBottom: theme.spacing(), + marginTop: theme.spacing(2), + padding: `${theme.spacing(1)} 0`, +})); + export default AppPanelSection; diff --git a/packages/manager/src/features/Linodes/LinodesCreate/AttachVLAN.tsx b/packages/manager/src/features/Linodes/LinodesCreate/AttachVLAN.tsx index 03037fdfa37..1dd7e98ff9e 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/AttachVLAN.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/AttachVLAN.tsx @@ -1,7 +1,6 @@ import { Interface } from '@linode/api-v4/lib/linodes'; import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { makeStyles } from '@mui/styles'; +import { useTheme } from '@mui/material/styles'; import * as React from 'react'; import { useQueryClient } from 'react-query'; @@ -20,22 +19,6 @@ import { import InterfaceSelect from '../LinodesDetail/LinodeSettings/InterfaceSelect'; // @TODO Delete this file when VPC is released -const useStyles = makeStyles((theme: Theme) => ({ - paragraphBreak: { - marginTop: theme.spacing(2), - }, - title: { - '& button': { - paddingLeft: theme.spacing(), - }, - alignItems: 'center', - display: 'flex', - marginBottom: theme.spacing(2), - }, - vlan: { - marginTop: theme.spacing(3), - }, -})); interface Props { handleVLANChange: (updatedInterface: Interface) => void; @@ -62,7 +45,7 @@ const AttachVLAN: React.FC = (props) => { vlanLabel, } = props; - const classes = useStyles(); + const theme = useTheme(); const queryClient = useQueryClient(); @@ -90,15 +73,25 @@ const AttachVLAN: React.FC = (props) => { )}.`; return ( - - + + Attach a VLAN{' '} {helperText ? : null} {regionalAvailabilityMessage} - + VLANs are used to create a private L2 Virtual Local Area Network between Linodes. A VLAN created or attached in this section will be assigned to the eth1 interface, with eth0 being used for connections diff --git a/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/index.tsx b/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/index.tsx index bf7d81fa67b..adc2f1457bf 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/index.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/index.tsx @@ -1,10 +1,12 @@ import React from 'react'; -import { CopyTooltip } from 'src/components/CopyTooltip/CopyTooltip'; -import { HighlightedMarkdown } from 'src/components/HighlightedMarkdown/HighlightedMarkdown'; import { sendApiAwarenessClickEvent } from 'src/utilities/analytics'; +import { + StyledCommandDiv, + StyledCopyTooltip, + StyledHighlightedMarkdown, +} from './styles'; -import { useCodeBlockStyles } from './styles'; export interface Props { command: string; commandType: string; @@ -13,25 +15,19 @@ export interface Props { const CodeBlock = (props: Props) => { const { command, commandType, language } = props; - const classes = useCodeBlockStyles(); const handleCopyIconClick = () => { sendApiAwarenessClickEvent('Copy Icon', commandType); }; return ( -
- + - -
+ + ); }; diff --git a/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/styles.ts b/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/styles.ts index cfc50a387ad..a6c18b11e8d 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/styles.ts +++ b/packages/manager/src/features/Linodes/LinodesCreate/CodeBlock/styles.ts @@ -1,43 +1,50 @@ -import { Theme } from '@mui/material/styles'; -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; +import { HighlightedMarkdown } from 'src/components/HighlightedMarkdown/HighlightedMarkdown'; +import { CopyTooltip } from 'src/components/CopyTooltip/CopyTooltip'; -export const useCodeBlockStyles = makeStyles((theme: Theme) => ({ - commandDisplay: { +export const StyledCommandDiv = styled('div', { label: 'StyledCommandDiv' })( + ({ theme }) => ({ '& pre': { marginBottom: 0, - marginTop: '24px', + marginTop: `${theme.spacing(3)}`, }, position: 'relative', - }, - commandWrapper: { - '& .hljs': { - '& .hljs-literal, .hljs-built_in': { - color: '#f8f8f2', - }, - '& .hljs-string': { - color: '#e6db74', - }, - '& .hljs-symbol': { - color: '#f8f8f2', - }, + }) +); - '& .hljs-variable': { - color: 'teal', - }, - backgroundColor: '#32363b', +export const StyledHighlightedMarkdown = styled(HighlightedMarkdown, { + label: 'StyledHighlightedMarkdown', +})(({ theme }) => ({ + '& .hljs': { + '& .hljs-literal, .hljs-built_in': { color: '#f8f8f2', - padding: `${theme.spacing(4)}px ${theme.spacing(2)}px`, }, - }, - copyIcon: { - '& svg': { - color: '#17CF73', + '& .hljs-string': { + color: '#e6db74', }, - '& svg:hover': { - color: '#00B159', + '& .hljs-symbol': { + color: '#f8f8f2', + }, + + '& .hljs-variable': { + color: 'teal', }, - position: 'absolute', - right: '12px', - top: '8px', + backgroundColor: '#32363b', + color: '#f8f8f2', + padding: `${theme.spacing(4)} ${theme.spacing(2)}`, + }, +})); + +export const StyledCopyTooltip = styled(CopyTooltip, { + label: 'StyledCopyTooltip', +})(({ theme }) => ({ + '& svg': { + color: '#17CF73', + }, + '& svg:hover': { + color: '#00B159', }, + position: 'absolute', + right: `${theme.spacing(1.5)}`, + top: `${theme.spacing(1)}`, })); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/LinodeCreate.styles.ts b/packages/manager/src/features/Linodes/LinodesCreate/LinodeCreate.styles.ts new file mode 100644 index 00000000000..dc3c949a13b --- /dev/null +++ b/packages/manager/src/features/Linodes/LinodesCreate/LinodeCreate.styles.ts @@ -0,0 +1,71 @@ +import { styled } from '@mui/material/styles'; +import { isPropValid } from 'src/utilities/isPropValid'; +import { Box } from 'src/components/Box'; +import { Button } from 'src/components/Button/Button'; +import { Paper } from 'src/components/Paper'; +import type { LinodeCreateProps } from './LinodeCreate'; +import TabPanels from 'src/components/core/ReachTabPanels'; + +type StyledLinodeCreateProps = Pick; + +export const StyledButtonGroupBox = styled(Box, { label: 'StyledButtonGroup' })( + ({ theme }) => ({ + marginTop: theme.spacing(3), + [theme.breakpoints.down('sm')]: { + justifyContent: 'flex-end', + }, + }) +); + +export const StyledCreateButton = styled(Button, { + label: 'StyledCreateButton', +})(({ theme }) => ({ + marginLeft: theme.spacing(1), + [theme.breakpoints.down('md')]: { + marginRight: theme.spacing(1), + }, +})); + +export const StyledForm = styled('form', { label: 'StyledForm' })({ + width: '100%', +}); + +export const StyledMessageDiv = styled('div', { + label: 'StyledMessageDiv', + shouldForwardProp: (prop) => isPropValid(['showAgreement'], prop), +})(({ theme, showAgreement }) => ({ + display: 'flex', + flexDirection: 'column' as const, + flexGrow: 1, + gap: theme.spacing(2), + [(theme.breakpoints.down('sm'), theme.breakpoints.down('md'))]: { + margin: theme.spacing(1), + }, + + // conditional styling + ...(showAgreement + ? { + maxWidth: '70%', + [theme.breakpoints.down('sm')]: { + maxWidth: 'unset', + }, + } + : {}), +})); + +export const StyledPaper = styled(Paper, { label: 'StyledPaper' })( + ({ theme }) => ({ + '& [role="tablist"]': { + marginBottom: theme.spacing(), + marginTop: theme.spacing(2), + }, + }) +); + +export const StyledTabPanel = styled(TabPanels, { label: 'StyledTabPanel' })( + ({ theme }) => ({ + '& .MuiPaper-root': { + padding: 0, + }, + }) +); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/LinodeCreate.tsx b/packages/manager/src/features/Linodes/LinodesCreate/LinodeCreate.tsx index 1b926413aa4..ca4e19ab2de 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/LinodeCreate.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/LinodeCreate.tsx @@ -1,9 +1,6 @@ import { InterfacePayload, restoreBackup } from '@linode/api-v4/lib/linodes'; import { Tag } from '@linode/api-v4/lib/tags/types'; import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { WithStyles, createStyles, withStyles } from '@mui/styles'; -import classNames from 'classnames'; import cloneDeep from 'lodash/cloneDeep'; import * as React from 'react'; import { MapDispatchToProps, connect } from 'react-redux'; @@ -13,7 +10,6 @@ import { v4 } from 'uuid'; import AccessPanel from 'src/components/AccessPanel/AccessPanel'; import { Box } from 'src/components/Box'; -import { Button } from 'src/components/Button/Button'; import { CheckoutSummary } from 'src/components/CheckoutSummary/CheckoutSummary'; import { CircleProgress } from 'src/components/CircleProgress'; import { DocsLink } from 'src/components/DocsLink/DocsLink'; @@ -24,7 +20,6 @@ import { SafeTabPanel } from 'src/components/SafeTabPanel/SafeTabPanel'; import { SelectRegionPanel } from 'src/components/SelectRegionPanel/SelectRegionPanel'; import { TabLinkList } from 'src/components/TabLinkList/TabLinkList'; import { Typography } from 'src/components/Typography'; -import { Paper } from 'src/components/Paper'; import TabPanels from 'src/components/core/ReachTabPanels'; import Tabs from 'src/components/core/ReachTabs'; import { DefaultProps as ImagesProps } from 'src/containers/images.container'; @@ -76,63 +71,18 @@ import { WithDisplayData, WithTypesRegionsAndImages, } from './types'; +import { + StyledButtonGroupBox, + StyledCreateButton, + StyledForm, + StyledMessageDiv, + StyledPaper, + StyledTabPanel, +} from './LinodeCreate.styles'; import type { Tab } from 'src/components/TabLinkList/TabLinkList'; -type ClassNames = - | 'buttonGroup' - | 'createButton' - | 'form' - | 'imageSelect' - | 'messageGroup' - | 'messageGroupMaxWidth' - | 'stackScriptWrapper'; - -const styles = (theme: Theme) => - createStyles({ - buttonGroup: { - marginTop: theme.spacing(3), - [theme.breakpoints.down('sm')]: { - justifyContent: 'flex-end', - }, - }, - createButton: { - marginLeft: theme.spacing(1), - [theme.breakpoints.down('md')]: { - marginRight: theme.spacing(1), - }, - }, - form: { - width: '100%', - }, - imageSelect: { - '& .MuiPaper-root': { - padding: 0, - }, - }, - messageGroup: { - display: 'flex', - flexDirection: 'column', - flexGrow: 1, - gap: theme.spacing(2), - [(theme.breakpoints.down('sm'), theme.breakpoints.down('md'))]: { - margin: theme.spacing(1), - }, - }, - messageGroupMaxWidth: { - maxWidth: '70%', - [theme.breakpoints.down('sm')]: { - maxWidth: 'unset', - }, - }, - stackScriptWrapper: { - '& [role="tablist"]': { - marginBottom: theme.spacing(), - marginTop: theme.spacing(2), - }, - }, - }); -interface Props { +export interface LinodeCreateProps { backupsMonthlyPrice?: null | number; checkValidation: LinodeCreateValidation; createType: CreateTypes; @@ -181,10 +131,9 @@ const errorMap = [ type InnerProps = WithTypesRegionsAndImages & ReduxStateProps & StackScriptFormStateHandlers & - Props; + LinodeCreateProps; -type CombinedProps = Props & - InnerProps & +type CombinedProps = InnerProps & AllFormStateAndHandlers & AppsData & ReduxStateProps & @@ -192,7 +141,6 @@ type CombinedProps = Props & ImagesProps & WithLinodesProps & RegionsProps & - WithStyles & WithTypesProps & RouteComponentProps<{}> & FeatureFlagConsumerProps; @@ -265,7 +213,6 @@ export class LinodeCreate extends React.PureComponent< const { accountBackupsEnabled, backupsMonthlyPrice, - classes, errors, formIsSubmitting, handleAgreementChange, @@ -405,7 +352,7 @@ export class LinodeCreate extends React.PureComponent< (imageIsCloudInitCompatible || linodeIsCloudInitCompatible); return ( -
+ {hasErrorFor.none && !!showGeneralError && ( @@ -453,10 +400,10 @@ export class LinodeCreate extends React.PureComponent< - + Create From: - + - - + + @@ -635,12 +582,7 @@ export class LinodeCreate extends React.PureComponent< flexWrap="wrap" justifyContent={showAgreement ? 'space-between' : 'flex-end'} > -
+ {({ text }) => {text}} @@ -651,50 +593,47 @@ export class LinodeCreate extends React.PureComponent< onChange={handleAgreementChange} /> ) : null} -
+ - - - + - +
- +
); } @@ -876,10 +815,8 @@ const mapDispatchToProps: MapDispatchToProps = ( setTab: (value) => dispatch(handleChangeCreateType(value)), }); -const styled = withStyles(styles); - const connected = connect(undefined, mapDispatchToProps); -const enhanced = recompose(connected, styled); +const enhanced = recompose(connected); export default enhanced(LinodeCreate); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/SelectAppPanel.tsx b/packages/manager/src/features/Linodes/LinodesCreate/SelectAppPanel.tsx index aa5c2d053ed..f587c1918c8 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/SelectAppPanel.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/SelectAppPanel.tsx @@ -1,6 +1,5 @@ import { UserDefinedField } from '@linode/api-v4/lib/stackscripts'; -import { Theme } from '@mui/material/styles'; -import { WithStyles, createStyles, withStyles } from '@mui/styles'; +import { styled, Theme } from '@mui/material/styles'; import * as React from 'react'; import { compose } from 'recompose'; @@ -14,23 +13,6 @@ import { getQueryParamFromQueryString } from 'src/utilities/queryParams'; import Panel from './Panel'; import { AppsData } from './types'; -type ClassNames = 'loading' | 'panel'; - -const styles = (theme: Theme) => - createStyles({ - loading: { - '& >div:first-of-type': { - height: 450, - }, - }, - panel: { - boxShadow: `${theme.color.boxShadow} 0px -15px 10px -10px inset`, - height: 450, - marginBottom: theme.spacing(3), - overflowY: 'auto', - }, - }); - interface Props extends AppsData { disabled: boolean; error?: string; @@ -48,14 +30,12 @@ interface Props extends AppsData { selectedStackScriptID?: number; } -type CombinedProps = Props & WithStyles; - -class SelectAppPanel extends React.PureComponent { +class SelectAppPanel extends React.PureComponent { componentDidMount() { this.clickAppIfQueryParamExists(); } - componentDidUpdate(prevProps: CombinedProps) { + componentDidUpdate(prevProps: Props) { if ( typeof prevProps.appInstances === 'undefined' && typeof this.props.appInstances !== 'undefined' @@ -69,7 +49,6 @@ class SelectAppPanel extends React.PureComponent { appInstances, appInstancesError, appInstancesLoading, - classes, disabled, error, handleClick, @@ -82,19 +61,19 @@ class SelectAppPanel extends React.PureComponent { if (appInstancesError) { return ( - + - + ); } if (appInstancesLoading || !appInstances) { return ( - - + + - - + + ); } @@ -118,7 +97,7 @@ class SelectAppPanel extends React.PureComponent { const isFilteringOrSearching = isFiltering || isSearching; return ( - + {error && } {!isFilteringOrSearching ? ( { searchValue={searchValue} selectedStackScriptID={selectedStackScriptID} /> - + ); } @@ -196,9 +175,25 @@ class SelectAppPanel extends React.PureComponent { }; } -const styled = withStyles(styles); +const commonStyling = (theme: Theme) => ({ + boxShadow: `${theme.color.boxShadow} 0px -15px 10px -10px inset`, + height: 450, + marginBottom: theme.spacing(3), + overflowY: 'auto' as const, +}); + +const StyledPanel = styled(Panel, { label: 'StyledPanel' })(({ theme }) => ({ + ...commonStyling(theme), +})); + +const StyledPaper = styled(Paper, { label: 'StyledPaper' })(({ theme }) => ({ + ...commonStyling(theme), +})); + +const StyledLoadingSpan = styled('span', { label: 'StyledLoadingSpan' })({ + '& >div:first-of-type': { + height: 450, + }, +}); -export default compose( - styled, - React.memo -)(SelectAppPanel); +export default compose(React.memo)(SelectAppPanel); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/SelectBackupPanel.tsx b/packages/manager/src/features/Linodes/LinodesCreate/SelectBackupPanel.tsx index fac29e6c914..782db32b3b3 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/SelectBackupPanel.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/SelectBackupPanel.tsx @@ -4,8 +4,7 @@ import { LinodeBackupsResponse, } from '@linode/api-v4/lib/linodes'; import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { WithStyles, createStyles, withStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import * as React from 'react'; import { compose } from 'recompose'; @@ -21,6 +20,9 @@ import { } from 'src/containers/profile.container'; import { formatDate } from 'src/utilities/formatDate'; +import type { StyledTypographyProps } from './SelectLinodePanel'; +import { isPropValid } from 'src/utilities/isPropValid'; + export const aggregateBackups = ( backups: LinodeBackupsResponse ): LinodeBackup[] => { @@ -38,26 +40,6 @@ export interface LinodeWithBackups extends Linode { currentBackups: LinodeBackupsResponse; } -type ClassNames = 'panelBody' | 'root' | 'wrapper'; - -const styles = (theme: Theme) => - createStyles({ - panelBody: { - padding: `${theme.spacing(2)} 0 0`, - width: '100%', - }, - root: { - backgroundColor: theme.color.white, - flexGrow: 1, - marginTop: theme.spacing(3), - width: '100%', - }, - wrapper: { - minHeight: 120, - padding: theme.spacing(1), - }, - }); - interface BackupInfo { details: string; title: string; @@ -77,9 +59,7 @@ interface State { backups?: LinodeBackup[]; } -type StyledProps = Props & WithStyles; - -type CombinedProps = StyledProps & WithProfileProps; +type CombinedProps = Props & WithProfileProps; class SelectBackupPanel extends React.Component { getBackupInfo(backup: LinodeBackup) { @@ -104,7 +84,6 @@ class SelectBackupPanel extends React.Component { render() { const { - classes, error, loading, selectedLinodeID, @@ -116,28 +95,23 @@ class SelectBackupPanel extends React.Component { : []; return ( - + {error && } Select Backup - + {loading ? ( ) : selectedLinodeID ? ( // eslint-disable-next-line react/jsx-no-useless-fragment {aggregatedBackups.length !== 0 ? ( - + {aggregatedBackups.map((backup) => { return this.renderCard(backup); })} - + ) : ( No backup available )} @@ -145,8 +119,8 @@ class SelectBackupPanel extends React.Component { ) : ( First, select a Linode )} - - + + ); } @@ -176,10 +150,31 @@ class SelectBackupPanel extends React.Component { }; } -const styled = withStyles(styles); +const StyledTypography = styled(Typography, { + label: 'StyledTypography', + shouldForwardProp: (prop) => isPropValid(['component'], prop), +})(({ theme }) => ({ + padding: `${theme.spacing(2)} 0 0`, + width: '100%', +})); + +const StyledRootPaper = styled(Paper, { label: 'StyledRootPaper' })( + ({ theme }) => ({ + backgroundColor: theme.color.white, + flexGrow: 1, + width: '100%', + marginTop: theme.spacing(3), + }) +); + +const StyledWrapperGrid = styled(Grid, { label: 'StyledWrapperGrid' })( + ({ theme }) => ({ + minHeight: 120, + padding: theme.spacing(1), + }) +); export default compose( RenderGuard, - styled, withProfile )(SelectBackupPanel); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/SelectLinodePanel.tsx b/packages/manager/src/features/Linodes/LinodesCreate/SelectLinodePanel.tsx index e031a1f8879..9c228f7e88f 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/SelectLinodePanel.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/SelectLinodePanel.tsx @@ -1,7 +1,6 @@ import { Linode } from '@linode/api-v4/lib/linodes'; import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { WithStyles, createStyles, withStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import * as React from 'react'; import { compose } from 'recompose'; @@ -12,26 +11,13 @@ import RenderGuard, { RenderGuardProps } from 'src/components/RenderGuard'; import { SelectionCard } from 'src/components/SelectionCard/SelectionCard'; import { Typography } from 'src/components/Typography'; import { Paper } from 'src/components/Paper'; +import { isPropValid } from 'src/utilities/isPropValid'; export interface ExtendedLinode extends Linode { heading: string; subHeadings: string[]; } -type ClassNames = 'panelBody' | 'root'; - -const styles = (theme: Theme) => - createStyles({ - panelBody: { - padding: `${theme.spacing(2)} 0 0`, - }, - root: { - backgroundColor: theme.color.white, - flexGrow: 1, - width: '100%', - }, - }); - interface Notice { level: 'error' | 'warning'; // most likely only going to need these two 'warning'; 'warning'; text: string; @@ -47,13 +33,9 @@ interface Props { selectedLinodeID?: number; } -type StyledProps = Props & WithStyles; - -type CombinedProps = StyledProps; - -class SelectLinodePanel extends React.Component { +class SelectLinodePanel extends React.Component { render() { - const { classes, disabled, error, header, linodes, notice } = this.props; + const { disabled, error, header, linodes, notice } = this.props; return ( @@ -67,7 +49,7 @@ class SelectLinodePanel extends React.Component { }) => { return ( <> - + {error && } {notice && !disabled && ( { {!!header ? header : 'Select Linode'} - + {linodesData.map((linode) => { return this.renderCard(linode); })} - - + + { } } -const styled = withStyles(styles); +export type StyledTypographyProps = { component: string }; + +const StyledTypography = styled(Typography, { + label: 'StyledTypography', + shouldForwardProp: (prop) => isPropValid(['component'], prop), +})(({ theme }) => ({ + padding: `${theme.spacing(2)} 0 0`, +})); + +const StyledPaper = styled(Paper, { label: 'StyledPaper' })(({ theme }) => ({ + backgroundColor: theme.color.white, + flexGrow: 1, + width: '100%', +})); -export default compose( - RenderGuard, - styled -)(SelectLinodePanel); +export default compose(RenderGuard)( + SelectLinodePanel +); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/SelectPlanPanel/PlanContainer.styles.ts b/packages/manager/src/features/Linodes/LinodesCreate/SelectPlanPanel/PlanContainer.styles.ts index 62f1ca3b2e8..39527a4e3d4 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/SelectPlanPanel/PlanContainer.styles.ts +++ b/packages/manager/src/features/Linodes/LinodesCreate/SelectPlanPanel/PlanContainer.styles.ts @@ -7,6 +7,7 @@ import { isPropValid } from 'src/utilities/isPropValid'; type StyledTableCellPropsProps = TableCellProps & { isPlanCell?: boolean; }; + export const StyledTable = styled(Table, { label: 'StyledTable', shouldForwardProp: (prop) => isPropValid(['isDisabled'], prop), diff --git a/packages/manager/src/features/Linodes/LinodesCreate/SelectionCardWrapper.tsx b/packages/manager/src/features/Linodes/LinodesCreate/SelectionCardWrapper.tsx index 98917a309b6..c94d43ff9e8 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/SelectionCardWrapper.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/SelectionCardWrapper.tsx @@ -27,21 +27,6 @@ interface Props { userDefinedFields: UserDefinedField[]; } -const InfoGrid = styled(Grid, { - label: 'InfoGrid', -})(({ theme }) => ({ - '& svg': { - height: '19px', - width: '19px', - }, - color: theme.palette.primary.main, - display: 'flex', - justifyContent: 'flex-end', - maxWidth: 40, - padding: theme.spacing(1), - paddingLeft: 0, -})); - export const SelectionCardWrapper: React.FC = (props) => { const theme = useTheme(); const { @@ -125,4 +110,19 @@ export const SelectionCardWrapper: React.FC = (props) => { ); }; +const InfoGrid = styled(Grid, { + label: 'InfoGrid', +})(({ theme }) => ({ + '& svg': { + height: '19px', + width: '19px', + }, + color: theme.palette.primary.main, + display: 'flex', + justifyContent: 'flex-end', + maxWidth: 40, + padding: theme.spacing(1), + paddingLeft: 0, +})); + export default SelectionCardWrapper; diff --git a/packages/manager/src/features/Linodes/LinodesCreate/TabbedContent/CommonTabbedContent.styles.ts b/packages/manager/src/features/Linodes/LinodesCreate/TabbedContent/CommonTabbedContent.styles.ts new file mode 100644 index 00000000000..ce9ee727724 --- /dev/null +++ b/packages/manager/src/features/Linodes/LinodesCreate/TabbedContent/CommonTabbedContent.styles.ts @@ -0,0 +1,14 @@ +import Grid from '@mui/material/Unstable_Grid2'; +import { styled } from '@mui/material/styles'; + +export const StyledGrid = styled(Grid, { label: 'StyledGrid' })( + ({ theme }) => ({ + [theme.breakpoints.up('md')]: { + maxWidth: '100%', + }, + width: '100%', + flexBasis: '100%', + paddingTop: 0, + paddingBottom: 0, + }) +); diff --git a/packages/manager/src/features/Linodes/LinodesCreate/TabbedContent/FromAppsContent.tsx b/packages/manager/src/features/Linodes/LinodesCreate/TabbedContent/FromAppsContent.tsx index ab3c7073727..48c8b645149 100644 --- a/packages/manager/src/features/Linodes/LinodesCreate/TabbedContent/FromAppsContent.tsx +++ b/packages/manager/src/features/Linodes/LinodesCreate/TabbedContent/FromAppsContent.tsx @@ -1,8 +1,6 @@ import { Image } from '@linode/api-v4/lib/images'; import { StackScript, UserDefinedField } from '@linode/api-v4/lib/stackscripts'; -import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { WithStyles, createStyles, withStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import compact from 'lodash/compact'; import curry from 'lodash/curry'; import { assocPath } from 'ramda'; @@ -33,8 +31,7 @@ import { WithTypesRegionsAndImages, } from '../types'; import { filterUDFErrors } from './formUtilities'; - -type ClassNames = 'filter' | 'main' | 'search' | 'searchAndFilter' | 'sidebar'; +import { StyledGrid } from './CommonTabbedContent.styles'; const appCategories = [ 'Control Panels', @@ -57,38 +54,6 @@ const appCategoryOptions = appCategories.map((categoryName) => ({ // type AppCategory = typeof appCategories; -const styles = (theme: Theme) => - createStyles({ - filter: { - flexGrow: 1.5, - }, - main: { - [theme.breakpoints.up('md')]: { - maxWidth: '100%', - }, - }, - search: { - '& .input': { - maxWidth: 'none', - }, - flexGrow: 10, - }, - searchAndFilter: { - '& > h2': { - width: '100%', - }, - display: 'flex', - gap: theme.spacing(), - justifyContent: 'space-between', - marginTop: theme.spacing(), - }, - sidebar: { - [theme.breakpoints.up('md')]: { - marginTop: '-130px !important', - }, - }, - }); - const errorResources = { image: 'Image', label: 'A label', @@ -103,14 +68,12 @@ interface Props { setNumberOfNodesForAppCluster: (num: number) => void; } -type InnerProps = Props & +type CombinedProps = Props & AppsData & ReduxStateProps & StackScriptFormStateHandlers & WithTypesRegionsAndImages; -type CombinedProps = WithStyles & InnerProps; - interface State { categoryFilter: Item | null; detailDrawerOpen: boolean; @@ -180,7 +143,6 @@ class FromAppsContent extends React.Component { appInstancesLoading, availableStackScriptImages: compatibleImages, availableUserDefinedFields: userDefinedFields, - classes, errors, selectedImageID, selectedStackScriptID, @@ -224,11 +186,11 @@ class FromAppsContent extends React.Component { return ( - + Select an App - - + + { onSearch={this.onSearch} value={query} /> - - + + { options={dayOptions} placeholder="Choose a day" /> - + = React.memo((props) => { /> {handleDelete ? ( - + @@ -555,4 +541,9 @@ export const IPSharingRow: React.FC = React.memo((props) => { ); }); +const StyledSelect = styled(Select, { label: 'StyledSelect' })({ + marginTop: 0, + width: '100%', +}); + export default IPSharingPanel; diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/IPTransfer.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/IPTransfer.tsx index 1184da68dfa..3f3ae0d5d49 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/IPTransfer.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/IPTransfer.tsx @@ -1,7 +1,7 @@ import { IPRange } from '@linode/api-v4/lib/networking'; import { APIError } from '@linode/api-v4/lib/types'; import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; +import { styled, useTheme } from '@mui/material/styles'; import { both, compose, @@ -16,7 +16,6 @@ import { } from 'ramda'; import * as React from 'react'; import { debounce } from 'throttle-debounce'; -import { makeStyles } from 'tss-react/mui'; import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel'; import { CircleProgress } from 'src/components/CircleProgress'; @@ -37,52 +36,6 @@ import { } from 'src/queries/linodes/networking'; import { getAPIErrorOrDefault } from 'src/utilities/errorUtils'; -const useStyles = makeStyles()((theme: Theme) => ({ - actionsLabel: { - [theme.breakpoints.down('sm')]: { - display: 'none', - }, - }, - autoGridsm: { - minWidth: 175, - [theme.breakpoints.up('sm')]: { - flexBasis: 'auto', - maxWidth: 'auto', - }, - }, - emptyStateText: { - color: theme.color.grey1, - marginTop: theme.spacing(2), - }, - ipField: { - marginTop: 0, - [theme.breakpoints.up('sm')]: { - width: 175, - }, - width: '100%', - }, - ipFieldLabel: { - [theme.breakpoints.up('sm')]: { - width: `calc(175px + ${theme.spacing(2)})`, - }, - width: '100%', - }, - loading: { - display: 'flex', - justifyContent: 'center', - }, - networkActionText: { - marginBottom: theme.spacing(2), - }, - sourceIPWrapper: { - alignItems: 'center', - display: 'flex', - [theme.breakpoints.down('sm')]: { - width: '100%', - }, - }, -})); - interface Props { linodeId: number; onClose: () => void; @@ -140,7 +93,7 @@ export const getLinodeIPv6Ranges = ( const LinodeNetworkingIPTransferPanel = (props: Props) => { const { linodeId, onClose, open, readOnly } = props; - const { classes } = useStyles(); + const theme = useTheme(); const { mutateAsync: assignAddresses } = useAssignAdressesMutation(); const { data: linode } = useLinodeQuery(linodeId, open); @@ -300,12 +253,29 @@ const LinodeNetworkingIPTransferPanel = (props: Props) => { return ( - - + + {state.sourceIP} - + { overflowPortal value={defaultLinode} /> - + ); }; @@ -380,7 +350,7 @@ const LinodeNetworkingIPTransferPanel = (props: Props) => { }); return ( - +
@@ -364,3 +332,15 @@ export const LinodeVolumes = connected((props: Props) => { ); }); + +const StyledNewWrapperGrid = styled(Grid, { label: 'StyledNewWrapperGrid' })( + ({ theme }) => ({ + '&.MuiGrid-item': { + padding: 5, + }, + [theme.breakpoints.down('sm')]: { + marginLeft: `-${theme.spacing(1.5)}`, + marginTop: `-${theme.spacing(1)}`, + }, + }) +); diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeStorage/ResizeDiskDrawer.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeStorage/ResizeDiskDrawer.tsx index d43eb68f9c4..32532724a44 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeStorage/ResizeDiskDrawer.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeStorage/ResizeDiskDrawer.tsx @@ -1,7 +1,6 @@ import { Disk } from '@linode/api-v4/lib/linodes'; import { ResizeLinodeDiskSchema } from '@linode/validation'; -import { Theme } from '@mui/material/styles'; -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import { useFormik } from 'formik'; import { useSnackbar } from 'notistack'; import * as React from 'react'; @@ -26,13 +25,6 @@ import { handleAPIErrors } from 'src/utilities/formikErrorUtils'; import { calculateDiskFree } from './CreateDiskDrawer'; -const useStyles = makeStyles((theme: Theme) => ({ - formHelperTextLink: { - display: 'block', - marginTop: theme.spacing(1), - }, -})); - export interface Props { disk: Disk | undefined; linodeId: number; @@ -51,8 +43,6 @@ const handleLinkClick = (label: string) => { export const ResizeDiskDrawer = (props: Props) => { const { disk, linodeId, onClose, open } = props; - const classes = useStyles(); - const { enqueueSnackbar } = useSnackbar(); const { mutateAsync: resizeDisk, reset } = useLinodeDiskResizeMutation( @@ -106,17 +96,16 @@ export const ResizeDiskDrawer = (props: Props) => { The size of a Linode Compute Instance’s disk can be increased or decreased as needed. - { handleLinkClick('Learn more about restrictions to keep in mind.'); }} to={ 'https://www.linode.com/docs/products/compute/compute-instances/guides/disks-and-storage/' } - className={classes.formHelperTextLink} > Learn more about restrictions to keep in mind. - + ); + +const StyledLink = styled(Link, { label: 'StyledLink' })(({ theme }) => ({ + display: 'block', + marginTop: theme.spacing(1), +})); diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/ActivityRow.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/ActivityRow.tsx index 9c3913e5cad..8480c53ef1c 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/ActivityRow.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/ActivityRow.tsx @@ -1,7 +1,6 @@ import { Event } from '@linode/api-v4/lib/account'; import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { WithStyles, createStyles, withStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import * as React from 'react'; import { DateTimeDisplay } from 'src/components/DateTimeDisplay'; @@ -9,26 +8,12 @@ import { Typography } from 'src/components/Typography'; import eventMessageGenerator from 'src/eventMessageGenerator'; import { formatEventSeconds } from 'src/utilities/minute-conversion/minute-conversion'; -type ClassNames = 'root'; - -const styles = (theme: Theme) => - createStyles({ - root: { - borderBottom: `1px solid ${theme.palette.divider}`, - margin: 0, - padding: theme.spacing(1), - width: '100%', - }, - }); - interface Props { event: Event; } -type CombinedProps = Props & WithStyles; - -export const ActivityRow: React.FC = (props) => { - const { classes, event } = props; +export const ActivityRow = (props: Props) => { + const { event } = props; const message = eventMessageGenerator(event); @@ -43,9 +28,8 @@ export const ActivityRow: React.FC = (props) => { } return ( - = (props) => { - + ); }; -const styled = withStyles(styles); +const StyledGrid = styled(Grid, { label: 'StyledGrid' })(({ theme }) => ({ + borderBottom: `1px solid ${theme.palette.divider}`, + margin: 0, + padding: theme.spacing(1), + width: '100%', +})); -export default styled(ActivityRow); +export default ActivityRow; diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/LinodeSummary.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/LinodeSummary.tsx index 190822c759f..0a8ec7787d8 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/LinodeSummary.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeSummary/LinodeSummary.tsx @@ -1,6 +1,5 @@ import Grid from '@mui/material/Unstable_Grid2'; -import { Theme } from '@mui/material/styles'; -import { createStyles, makeStyles, useTheme } from '@mui/styles'; +import { styled, useTheme } from '@mui/material/styles'; import { DateTime } from 'luxon'; import * as React from 'react'; import { useParams } from 'react-router-dom'; @@ -34,53 +33,6 @@ import { getDateOptions } from './helpers'; setUpCharts(); -const useStyles = makeStyles((theme: Theme) => - createStyles({ - chartSelect: { - maxWidth: 150, - }, - emptyText: { - marginTop: theme.spacing(), - textAlign: 'center', - }, - graphControls: { - display: 'flex', - justifyContent: 'flex-end', - marginBottom: theme.spacing(), - }, - graphGrids: { - flexWrap: 'nowrap', - margin: 0, - [theme.breakpoints.down(1100)]: { - flexWrap: 'wrap', - }, - }, - grid: { - '& h2': { - fontSize: '1rem', - }, - '&.MuiGrid-item': { - padding: theme.spacing(2), - }, - backgroundColor: theme.bg.offWhite, - border: `solid 1px ${theme.borderColors.divider}`, - marginBottom: theme.spacing(2), - [theme.breakpoints.up(1100)]: { - '&:first-of-type': { - marginRight: theme.spacing(2), - }, - }, - }, - labelRangeSelect: { - fontSize: '1rem', - paddingRight: theme.spacing(2), - }, - root: { - width: '100%', - }, - }) -); - interface Props { isBareMetalInstance: boolean; linodeCreated: string; @@ -92,8 +44,7 @@ const LinodeSummary: React.FC = (props) => { const { isBareMetalInstance, linodeCreated } = props; const { linodeId } = useParams<{ linodeId: string }>(); const id = Number(linodeId); - const theme = useTheme(); - const classes = useStyles(); + const theme = useTheme(); const { data: profile } = useProfile(); const timezone = profile?.timezone || DateTime.local().zoneName; @@ -236,14 +187,14 @@ const LinodeSummary: React.FC = (props) => { errorText={ <>
- + {STATS_NOT_READY_MESSAGE} - +
- + CPU, Network, and Disk stats will be available shortly - +
} @@ -274,10 +225,17 @@ const LinodeSummary: React.FC = (props) => { return ( - - -