Showing
1 changed file
with
19 additions
and
2 deletions
... | @@ -8,6 +8,7 @@ import TableBody from '@material-ui/core/TableBody'; | ... | @@ -8,6 +8,7 @@ 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 CircularProgress from '@material-ui/core/CircularProgress'; | ||
11 | 12 | ||
12 | const styles = theme => ({ | 13 | const styles = theme => ({ |
13 | root: { | 14 | root: { |
... | @@ -17,16 +18,21 @@ const styles = theme => ({ | ... | @@ -17,16 +18,21 @@ const styles = theme => ({ |
17 | }, | 18 | }, |
18 | table: { | 19 | table: { |
19 | minWidth: 1080 | 20 | minWidth: 1080 |
21 | + }, | ||
22 | + progress: { | ||
23 | + margine: theme.spacing.unit*2 | ||
20 | } | 24 | } |
21 | }) | 25 | }) |
22 | 26 | ||
23 | class App extends Component { | 27 | class App extends Component { |
24 | state = { | 28 | state = { |
25 | - customers: "" | 29 | + customers: "", |
30 | + completed: 0 | ||
26 | } | 31 | } |
27 | 32 | ||
28 | //모든 컴포넌트 준비 완료일 때 실행 -- react가 라이브러리이기 때문 ! | 33 | //모든 컴포넌트 준비 완료일 때 실행 -- react가 라이브러리이기 때문 ! |
29 | componentDidMount() { | 34 | componentDidMount() { |
35 | + this.timer = setInterval(this.progress,20); | ||
30 | this.callApi() | 36 | this.callApi() |
31 | .then(res => this.setState({customers: res})) | 37 | .then(res => this.setState({customers: res})) |
32 | .catch(err => console.log(err)); | 38 | .catch(err => console.log(err)); |
... | @@ -39,6 +45,11 @@ class App extends Component { | ... | @@ -39,6 +45,11 @@ class App extends Component { |
39 | return body; | 45 | return body; |
40 | } | 46 | } |
41 | 47 | ||
48 | + progress = () => { | ||
49 | + const { completed } = this.state; | ||
50 | + this.setState({completed : completed >=100 ? 0: completed +1}); | ||
51 | + } | ||
52 | + | ||
42 | render() { | 53 | render() { |
43 | const { classes } = this.props; | 54 | const { classes } = this.props; |
44 | return ( | 55 | return ( |
... | @@ -58,7 +69,13 @@ class App extends Component { | ... | @@ -58,7 +69,13 @@ class App extends Component { |
58 | <TableBody> | 69 | <TableBody> |
59 | {this.state.customers ? this.state.customers.map (c=> { | 70 | {this.state.customers ? this.state.customers.map (c=> { |
60 | return (<Customer key={c.id} id={c.id} image={c.image} name={c.name} birthday={c.birthday} gender={c.gender} job={c.job} />) | 71 | return (<Customer key={c.id} id={c.id} image={c.image} name={c.name} birthday={c.birthday} gender={c.gender} job={c.job} />) |
61 | - }) : ""} | 72 | + }) : |
73 | + <TableRow> | ||
74 | + <TableCell colSpan="6" align="center"> | ||
75 | + <CircularProgress className={classes.progress} varient="determinate" value={this.state.completed}/> | ||
76 | + </TableCell> | ||
77 | + </TableRow> | ||
78 | + } | ||
62 | </TableBody> | 79 | </TableBody> |
63 | </Table> | 80 | </Table> |
64 | </Paper> | 81 | </Paper> | ... | ... |
-
Please register or login to post a comment