Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정성훈
/
MEALKHU
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
swa07016
2020-05-29 23:38:55 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
58366e99c4491d7b5c27059c0b2ab530c84ec6fa
58366e99
1 parent
bcf9d9e7
Loading 컴포넌트 구현
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
13 deletions
client/public/index.html
client/src/components/Loading.js
client/src/pages/MenuPage.js
client/public/index.html
View file @
58366e9
...
...
@@ -36,7 +36,7 @@ height: 100%;
<body
style=
"width : 100%; height:100%; margin: 0;"
>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div
id=
"root"
style=
"width : 100%; height:100%;"
></div>
<h1>
안녕
</h1>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
...
...
client/src/components/Loading.js
0 → 100644
View file @
58366e9
import
React
from
'react'
;
import
{
Spinner
}
from
'reactstrap'
;
const
Loading
=
(
props
)
=>
{
return
(
<
span
style
=
{{
'display'
:
'flex'
,
'width'
:
'100%'
,
"height"
:
'85%'
,
'textAlign'
:
'center'
,
'alignItems'
:
'center'
}}
><
span
style
=
{{
'margin'
:
'0 auto'
}}
><
Spinner
color
=
"danger"
style
=
{{
width
:
'2rem'
,
height
:
'2rem'
,
marginRight
:
'1rem'
}}
/><h1 style={{'display':'inline'}}>Loading..</
h1
><
/span></
span
>
);
}
export
default
Loading
;
\ No newline at end of file
client/src/pages/MenuPage.js
View file @
58366e9
...
...
@@ -4,8 +4,7 @@ import MealCard from '../components/MealCard';
import
{
CustomInput
,
Form
,
FormGroup
,
Label
}
from
'reactstrap'
;
import
{
Container
,
Row
,
Col
}
from
"reactstrap"
;
import
axios
from
'axios'
;
import
Loading
from
'../components/Loading'
;
const
MenuPage
=
(
props
)
=>
{
const
[
datas
,
setDatas
]
=
useState
([]);
...
...
@@ -14,7 +13,7 @@ const MenuPage = (props) => {
const
fetchData
=
async
()
=>
{
const
result
=
await
axios
(
'http://localhost:5000/api/datas'
,
// localhost
로 바꾸기
// localhost
로 바꾸기
);
setDatas
(
result
.
data
);
setIsLoading
(
true
);
...
...
@@ -27,7 +26,6 @@ const MenuPage = (props) => {
<>
<
NavBar
/>
<
Container
>
{
/* ???????? ???? */
}
{
/* <FormGroup>
<Label for="exampleCheckbox">??</Label>
...
...
@@ -37,12 +35,12 @@ const MenuPage = (props) => {
</div>
</FormGroup> */
}
<
/Container
>
<
Container
>
<
Row
xs
=
"2"
sm
=
"2"
md
=
"4"
>
{
isLoading
?
(
datas
.
map
((
data
)
=>
{
isLoading
?
(
<
Container
>
<
Row
xs
=
"2"
sm
=
"2"
md
=
"4"
>
{
datas
.
map
((
data
)
=>
<
Col
>
<
MealCard
id
=
{
data
.
id
}
...
...
@@ -57,12 +55,14 @@ const MenuPage = (props) => {
/
>
<
/Col
>
)
)
:
'Loading'
}
<
/Row
>
<
/Container>
)
:
<
Loading
/>
}
<
/Row
>
<
/Container
>
<
/
>
);
}
...
...
Please
register
or
login
to post a comment