Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이혜연
/
Make_your_own_ chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hyeyeon-sun
2020-06-14 10:06:02 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
169fb4242f9ba79008a9db651173a2ebe723c2d2
169fb424
1 parent
eef8a828
Add Customer API Loading View
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
management/client/src/App.js
management/client/src/App.js
View file @
169fb42
...
...
@@ -8,6 +8,7 @@ import TableBody from '@material-ui/core/TableBody';
import
TableRow
from
'@material-ui/core/TableRow'
;
import
TableCell
from
'@material-ui/core/TableCell'
;
import
{
withStyles
}
from
'@material-ui/core/styles'
;
import
CircularProgress
from
'@material-ui/core/CircularProgress'
;
const
styles
=
theme
=>
({
root
:
{
...
...
@@ -17,16 +18,21 @@ const styles = theme => ({
},
table
:
{
minWidth
:
1080
},
progress
:
{
margine
:
theme
.
spacing
.
unit
*
2
}
})
class
App
extends
Component
{
state
=
{
customers
:
""
customers
:
""
,
completed
:
0
}
//모든 컴포넌트 준비 완료일 때 실행 -- react가 라이브러리이기 때문 !
componentDidMount
()
{
this
.
timer
=
setInterval
(
this
.
progress
,
20
);
this
.
callApi
()
.
then
(
res
=>
this
.
setState
({
customers
:
res
}))
.
catch
(
err
=>
console
.
log
(
err
));
...
...
@@ -39,6 +45,11 @@ class App extends Component {
return
body
;
}
progress
=
()
=>
{
const
{
completed
}
=
this
.
state
;
this
.
setState
({
completed
:
completed
>=
100
?
0
:
completed
+
1
});
}
render
()
{
const
{
classes
}
=
this
.
props
;
return
(
...
...
@@ -58,7 +69,13 @@ class App extends Component {
<
TableBody
>
{
this
.
state
.
customers
?
this
.
state
.
customers
.
map
(
c
=>
{
return
(
<
Customer
key
=
{
c
.
id
}
id
=
{
c
.
id
}
image
=
{
c
.
image
}
name
=
{
c
.
name
}
birthday
=
{
c
.
birthday
}
gender
=
{
c
.
gender
}
job
=
{
c
.
job
}
/>
)
})
:
""
}
})
:
<
TableRow
>
<
TableCell
colSpan
=
"6"
align
=
"center"
>
<
CircularProgress
className
=
{
classes
.
progress
}
varient
=
"determinate"
value
=
{
this
.
state
.
completed
}
/
>
<
/TableCell
>
<
/TableRow
>
}
<
/TableBody
>
<
/Table
>
<
/Paper
>
...
...
Please
register
or
login
to post a comment