From 4417388bc9afe39841eef1a52ec9d6e52a2fd61b Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 7 Jan 2022 15:14:12 -0500 Subject: [PATCH] refactor(striker-ui): migrate MUI v4->5 on SharedStorage/SharedStorage --- .../SharedStorage/SharedStorage.tsx | 73 +++++++++++-------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/striker-ui/components/SharedStorage/SharedStorage.tsx b/striker-ui/components/SharedStorage/SharedStorage.tsx index 15cabeed..4c1a2500 100644 --- a/striker-ui/components/SharedStorage/SharedStorage.tsx +++ b/striker-ui/components/SharedStorage/SharedStorage.tsx @@ -1,7 +1,7 @@ import { useContext } from 'react'; -import { Box } from '@material-ui/core'; -import { makeStyles } from '@material-ui/core/styles'; +import { Box } from '@mui/material'; +import { styled } from '@mui/material/styles'; import { BodyText, HeaderText } from '../Text'; import { Panel, InnerPanel, PanelHeader } from '../Panels'; import SharedStorageHost from './SharedStorageHost'; @@ -10,12 +10,20 @@ import { AnvilContext } from '../AnvilContext'; import Spinner from '../Spinner'; import { LARGE_MOBILE_BREAKPOINT } from '../../lib/consts/DEFAULT_THEME'; -const useStyles = makeStyles((theme) => ({ - header: { +const PREFIX = 'SharedStorage'; + +const classes = { + header: `${PREFIX}-header`, + root: `${PREFIX}-root`, +}; + +const StyledDiv = styled('div')(({ theme }) => ({ + [`& .${classes.header}`]: { paddingTop: '.1em', paddingRight: '.7em', }, - root: { + + [`& .${classes.root}`]: { overflow: 'auto', height: '78vh', paddingLeft: '.3em', @@ -27,38 +35,43 @@ const useStyles = makeStyles((theme) => ({ })); const SharedStorage = (): JSX.Element => { - const classes = useStyles(); const { uuid } = useContext(AnvilContext); const { data, isLoading } = PeriodicFetch( `${process.env.NEXT_PUBLIC_API_URL}/get_shared_storage?anvil_uuid=${uuid}`, ); return ( - - {!isLoading ? ( - - {data?.storage_groups && - data.storage_groups.map( - (storageGroup: AnvilSharedStorageGroup): JSX.Element => ( - - - - - + + + {!isLoading ? ( + + {data?.storage_groups && + data.storage_groups.map( + (storageGroup: AnvilSharedStorageGroup): JSX.Element => ( + + + + + + - - - - - ), - )} - - ) : ( - - )} + + + + ), + )} + + ) : ( + + )} + ); };