Skip to content

Commit 1edb912

Browse files
committed
use backdrop instead of hacky centered spinner
1 parent 2868fe2 commit 1edb912

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

src/client/src/pages/Admin.js

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import React, {Component} from 'react';
2-
import {Paper, Button, TableHead} from "@material-ui/core";
3-
import Grid from '@material-ui/core/Grid';
4-
import Table from '@material-ui/core/Table';
5-
import TableBody from '@material-ui/core/TableBody';
6-
import TableCell from '@material-ui/core/TableCell';
7-
import TableContainer from '@material-ui/core/TableContainer';
8-
import TableRow from '@material-ui/core/TableRow';
2+
import {
3+
Grid,
4+
Paper,
5+
Button,
6+
TableHead,
7+
Backdrop,
8+
CircularProgress,
9+
CardContent,
10+
TableRow,
11+
TableContainer,
12+
TableCell,
13+
TableBody,
14+
Table
15+
} from "@material-ui/core";
16+
917
import {withStyles} from '@material-ui/core/styles';
10-
import CircularProgress from '@material-ui/core/CircularProgress';
1118
import _ from 'lodash';
12-
import CardContent from "@material-ui/core/CardContent";
1319
import moment from "moment";
1420

1521

1622
const styles = theme => ({
17-
loader: {
18-
marginTop: "40px"
19-
},
20-
spinner: {
21-
marginLeft: theme.spacing(2),
22-
display: 'flex', justifyContent: 'center', position: 'absolute', left: '50%', top: '50%',
23-
transform: 'translate(-50%, -50%)'
23+
backdrop: {
24+
zIndex: theme.zIndex.drawer + 1,
25+
color: '#fff',
2426
}
2527
});
2628

@@ -77,7 +79,7 @@ class Admin extends Component {
7779

7880
this.setState({isLoading: true});
7981

80-
var formData = new FormData();
82+
let formData = new FormData();
8183

8284
let files = _.get(event, 'target.[0].files');
8385
_.forEach(files, element => {
@@ -145,11 +147,9 @@ class Admin extends Component {
145147
return (
146148
<div style={{paddingLeft: 20}}>
147149
<h1>Admin Portal</h1>
148-
{this.state.isLoading === true ?
149-
<div className={classes.spinner}>
150+
<Backdrop className={classes.backdrop} open={this.state.isLoading === true}>
150151
<CircularProgress size={60}/>
151-
</div>
152-
:
152+
</Backdrop>
153153
<Grid container spacing={3} direction="column" style={{padding: 30}}>
154154
<Grid container spacing={3} direction="row">
155155
<Grid item sm={6}>
@@ -227,16 +227,12 @@ class Admin extends Component {
227227
</form>
228228
</CardContent>
229229
</Paper>
230-
231230
</Grid>
232-
233231
</Grid>
234-
235-
</Grid>}
232+
</Grid>
236233
</div>
237234
);
238235
}
239-
240236
}
241237

242238
export default withStyles(styles)(Admin);

0 commit comments

Comments
 (0)