refactor(striker-ui): migrate MUI v4->5 on Files/Files

main
Tsu-ba-me 3 years ago
parent 1d5175b68f
commit 95cc1871b0
  1. 23
      striker-ui/components/Files/Files.tsx

@ -1,7 +1,7 @@
import { useRef } from 'react'; import { useRef } from 'react';
import { Box, IconButton, Input, InputLabel } from '@material-ui/core'; import { Box, IconButton, Input, InputLabel } from '@mui/material';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@mui/icons-material/Add';
import { makeStyles } from '@material-ui/core/styles'; import { styled } from '@mui/material/styles';
import ICON_BUTTON_STYLE from '../../lib/consts/ICON_BUTTON_STYLE'; 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 Spinner from '../Spinner';
import { HeaderText } from '../Text'; import { HeaderText } from '../Text';
const useStyles = makeStyles(() => ({ const PREFIX = 'Files';
addFileButton: ICON_BUTTON_STYLE,
addFileInput: { const classes = {
addFileButton: `${PREFIX}-addFileButton`,
addFileInput: `${PREFIX}-addFileInput`,
};
const StyledDiv = styled('div')(() => ({
[`& .${classes.addFileButton}`]: ICON_BUTTON_STYLE,
[`& .${classes.addFileInput}`]: {
display: 'none', display: 'none',
}, },
})); }));
const Files = (): JSX.Element => { const Files = (): JSX.Element => {
const classes = useStyles();
const addFileInputRef = useRef<HTMLInputElement>(); const addFileInputRef = useRef<HTMLInputElement>();
const { data, isLoading } = PeriodicFetch( const { data, isLoading } = PeriodicFetch(
@ -32,6 +39,7 @@ const Files = (): JSX.Element => {
return ( return (
<Panel> <Panel>
<StyledDiv>
<Box style={{ display: 'flex', width: '100%' }}> <Box style={{ display: 'flex', width: '100%' }}>
<Box style={{ flexGrow: 1 }}> <Box style={{ flexGrow: 1 }}>
<HeaderText text="Files" /> <HeaderText text="Files" />
@ -62,6 +70,7 @@ const Files = (): JSX.Element => {
<span>{data}</span> <span>{data}</span>
</Box> </Box>
)} )}
</StyledDiv>
</Panel> </Panel>
); );
}; };

Loading…
Cancel
Save