From 95cc1871b0a82c75a57ff8aa0a2123b3cd459409 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 7 Jan 2022 15:43:06 -0500 Subject: [PATCH] refactor(striker-ui): migrate MUI v4->5 on Files/Files --- striker-ui/components/Files/Files.tsx | 81 +++++++++++++++------------ 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/striker-ui/components/Files/Files.tsx b/striker-ui/components/Files/Files.tsx index 2bee40e6..792ad45c 100644 --- a/striker-ui/components/Files/Files.tsx +++ b/striker-ui/components/Files/Files.tsx @@ -1,7 +1,7 @@ import { useRef } from 'react'; -import { Box, IconButton, Input, InputLabel } from '@material-ui/core'; -import AddIcon from '@material-ui/icons/Add'; -import { makeStyles } from '@material-ui/core/styles'; +import { Box, IconButton, Input, InputLabel } from '@mui/material'; +import AddIcon from '@mui/icons-material/Add'; +import { styled } from '@mui/material/styles'; import ICON_BUTTON_STYLE from '../../lib/consts/ICON_BUTTON_STYLE'; @@ -10,15 +10,22 @@ import PeriodicFetch from '../../lib/fetchers/periodicFetch'; import Spinner from '../Spinner'; import { HeaderText } from '../Text'; -const useStyles = makeStyles(() => ({ - addFileButton: ICON_BUTTON_STYLE, - addFileInput: { +const PREFIX = 'Files'; + +const classes = { + addFileButton: `${PREFIX}-addFileButton`, + addFileInput: `${PREFIX}-addFileInput`, +}; + +const StyledDiv = styled('div')(() => ({ + [`& .${classes.addFileButton}`]: ICON_BUTTON_STYLE, + + [`& .${classes.addFileInput}`]: { display: 'none', }, })); const Files = (): JSX.Element => { - const classes = useStyles(); const addFileInputRef = useRef(); const { data, isLoading } = PeriodicFetch( @@ -32,36 +39,38 @@ const Files = (): JSX.Element => { return ( - - - - - -
- - - - - - -
-
-
- {isLoading ? ( - - ) : ( - - {data} + + + + + + +
+ + + + + + +
+
- )} + {isLoading ? ( + + ) : ( + + {data} + + )} +
); };