Showing
2 changed files
with
19 additions
and
2 deletions
This diff is collapsed. Click to expand it.
| ... | @@ -8,6 +8,8 @@ import TableBody from '@material-ui/core/TableBody' | ... | @@ -8,6 +8,8 @@ import TableBody from '@material-ui/core/TableBody' |
| 8 | import TableRow from '@material-ui/core/TableRow' | 8 | import TableRow from '@material-ui/core/TableRow' |
| 9 | import TableCell from '@material-ui/core/TableCell' | 9 | import TableCell from '@material-ui/core/TableCell' |
| 10 | import {withStyles} from '@material-ui/core/styles'; | 10 | import {withStyles} from '@material-ui/core/styles'; |
| 11 | +import curcularProgress from '@material-ui/core/CircularProgress'; | ||
| 12 | +import CircularProgress from '@material-ui/core/CircularProgress'; | ||
| 11 | 13 | ||
| 12 | const styles = theme => ({ | 14 | const styles = theme => ({ |
| 13 | root: { | 15 | root: { |
| ... | @@ -17,6 +19,9 @@ const styles = theme => ({ | ... | @@ -17,6 +19,9 @@ const styles = theme => ({ |
| 17 | }, | 19 | }, |
| 18 | table: { | 20 | table: { |
| 19 | minWidth:1000 | 21 | minWidth:1000 |
| 22 | + }, | ||
| 23 | + progress:{ | ||
| 24 | + margin: theme.spacing.unit * 2 | ||
| 20 | } | 25 | } |
| 21 | }) | 26 | }) |
| 22 | 27 | ||
| ... | @@ -47,10 +52,12 @@ const students = [ | ... | @@ -47,10 +52,12 @@ const students = [ |
| 47 | class App extends Component{ | 52 | class App extends Component{ |
| 48 | 53 | ||
| 49 | state = { | 54 | state = { |
| 50 | - students: "" | 55 | + students: "", |
| 56 | + completed: 0 | ||
| 51 | } | 57 | } |
| 52 | 58 | ||
| 53 | componentDidMount() { | 59 | componentDidMount() { |
| 60 | + this.timer= setInterval(this.progress,20); | ||
| 54 | this.callApi() | 61 | this.callApi() |
| 55 | .then(res => this.setState({students: res})) | 62 | .then(res => this.setState({students: res})) |
| 56 | .catch(err => console.log(err)); | 63 | .catch(err => console.log(err)); |
| ... | @@ -62,6 +69,11 @@ class App extends Component{ | ... | @@ -62,6 +69,11 @@ class App extends Component{ |
| 62 | return body; | 69 | return body; |
| 63 | } | 70 | } |
| 64 | 71 | ||
| 72 | + progress=() =>{ | ||
| 73 | + const{completed}= this.state; | ||
| 74 | + this.setState({completed:completed >= 100 ?0:completed +1}); | ||
| 75 | + } | ||
| 76 | + | ||
| 65 | render(){ | 77 | render(){ |
| 66 | 78 | ||
| 67 | const {classes}= this.props; | 79 | const {classes}= this.props; |
| ... | @@ -102,7 +114,12 @@ class App extends Component{ | ... | @@ -102,7 +114,12 @@ class App extends Component{ |
| 102 | st_Score={c.st_Score} | 114 | st_Score={c.st_Score} |
| 103 | /> | 115 | /> |
| 104 | ); | 116 | ); |
| 105 | - }) : "" | 117 | + }) : |
| 118 | + <TableRow> | ||
| 119 | + <TableCell colSpan="9" allign="center"> | ||
| 120 | + <CircularProgress className={classes.progress} variant="determinate" value={this.state.completed}/> | ||
| 121 | + </TableCell> | ||
| 122 | + </TableRow> | ||
| 106 | } | 123 | } |
| 107 | </TableBody> | 124 | </TableBody> |
| 108 | 125 | ... | ... |
-
Please register or login to post a comment