migrate LoadingPlaceholder to Mui 5 (#96)
This commit is contained in:
@@ -8,16 +8,8 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import makeStyles from '@mui/styles/makeStyles';
|
|
||||||
import CircularProgress from '@mui/material/CircularProgress';
|
import CircularProgress from '@mui/material/CircularProgress';
|
||||||
|
import { Box } from '@mui/system';
|
||||||
const useStyles = makeStyles({
|
|
||||||
loading: {
|
|
||||||
margin: '10px auto',
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
shouldRender?: boolean | (() => boolean)
|
shouldRender?: boolean | (() => boolean)
|
||||||
@@ -30,7 +22,6 @@ export default function LoadingPlaceholder(props: IProps) {
|
|||||||
const {
|
const {
|
||||||
children, shouldRender, component, componentProps,
|
children, shouldRender, component, componentProps,
|
||||||
} = props;
|
} = props;
|
||||||
const classes = useStyles();
|
|
||||||
|
|
||||||
let condition = true;
|
let condition = true;
|
||||||
if (shouldRender !== undefined) {
|
if (shouldRender !== undefined) {
|
||||||
@@ -52,8 +43,13 @@ export default function LoadingPlaceholder(props: IProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.loading}>
|
<Box sx={{
|
||||||
|
margin: '10px auto',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<CircularProgress thickness={5} />
|
<CircularProgress thickness={5} />
|
||||||
</div>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user