Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Wico_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
조민지
2020-06-13 18:13:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
49be43f72b00fd0af950f2ad93be93dacc09d9b7
49be43f7
1 parent
fb6746a3
feat: react hook 세팅
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
49 deletions
frontend/src/components/Kickboard/KickboardHistoryTable.jsx
frontend/src/components/Kickboard/KickboardStatusCard.jsx
frontend/src/components/UserHistory/UserDataCard.jsx
frontend/src/components/UserHistory/UserHistoryCard.jsx
frontend/src/views/Kickboard.jsx
frontend/src/views/UserHistory.jsx
frontend/src/components/Kickboard/KickboardHistoryTable.jsx
View file @
49be43f
...
...
@@ -6,12 +6,13 @@ import { tdArray } from "variables/Variables.jsx";
const
thArray
=
[
'유저ID'
,
'대여 시각'
,
'반납 시각'
,
'대여 시간'
,
'이동 거리'
,
'대여 금액'
];
const
KickboardHistoryTable
=
()
=>
{
const
KickboardHistoryTable
=
(
props
)
=>
{
const
{
kbId
}
=
props
;
// category="Here is a subtitle for this table"
return
(
<
Card
title=
"000000번 킥보드 사용자 히스토리"
title=
{
`
$
{kbId}번 킥보드 사용자 히스토리`
}
ctTableFullWidth
ctTableResponsive
content=
{
...
...
frontend/src/components/Kickboard/KickboardStatusCard.jsx
View file @
49be43f
...
...
@@ -6,7 +6,7 @@ import moment from "moment";
// border: 1px solid #E3E3E3;
const
KickboardButton
=
styled
.
div
`
font-size: 1
6
px;
font-size: 1
5
px;
background-color: #e7e7e7;
border-radius: 4px;
color: #565656;
...
...
@@ -47,12 +47,13 @@ const kickboardDataKey = {
l
:
'최근 업데이트 시각'
,
};
const
KickboardStatusCard
=
()
=>
{
const
KickboardStatusCard
=
(
props
)
=>
{
const
{
kbId
}
=
props
;
const
getStats
=
`마지막 업데이트
${
moment
().
format
(
"YYYY/MM/DD hh:mm"
)}
`
;
return
(
<
Card
title=
{
'000000번 킥보드'
}
title=
{
`
$
{kbId}번 킥보드`
}
stats=
{
getStats
}
statsIcon=
"fa fa-history"
content=
{
...
...
frontend/src/components/UserHistory/UserDataCard.jsx
View file @
49be43f
...
...
@@ -9,12 +9,13 @@ const UserData = styled.div`
font-size: 15px;
`
;
const
UserDataCard
=
()
=>
{
const
UserDataCard
=
(
props
)
=>
{
const
getStats
=
`마지막 업데이트
${
moment
().
format
(
"YYYY/MM/DD hh:mm"
)}
`
;
const
{
userId
}
=
props
;
return
(
<
Card
title=
{
'000000번 사용자'
}
title=
{
`
$
{userId}번 사용자`
}
stats=
{
getStats
}
statsIcon=
"fa fa-history"
content=
{
...
...
frontend/src/components/UserHistory/UserHistoryCard.jsx
View file @
49be43f
import
React
,
{
Component
}
from
"react"
;
import
{
Grid
,
Row
,
Col
,
Table
}
from
"react-bootstrap"
;
import
styled
from
"styled-components"
;
import
Card
from
"components/Card/Card.jsx"
;
import
{
tdArray
}
from
"variables/Variables.jsx"
;
const
thArray
=
[
'킥보드 시리얼 번호'
,
'대여 시각'
,
'반납 시각'
,
'대여 시간'
,
'이동 거리'
,
'대여 금액'
];
class
UserHistoryCard
extends
Component
{
render
()
{
return
(
<
Card
title=
"Striped Table with Hover"
category=
"Here is a subtitle for this table"
ctTableFullWidth
ctTableResponsive
content=
{
<
Table
striped
hover
>
<
thead
>
<
tr
>
{
thArray
.
map
((
prop
,
key
)
=>
{
return
<
th
key=
{
key
}
>
{
prop
}
</
th
>;
})
}
</
tr
>
</
thead
>
<
tbody
>
{
tdArray
.
map
((
prop
,
key
)
=>
{
return
(
<
tr
key=
{
key
}
>
{
prop
.
map
((
prop
,
key
)
=>
{
return
<
td
key=
{
key
}
>
{
prop
}
</
td
>;
})
}
</
tr
>
);
const
UserHistoryCard
=
(
props
)
=>
{
const
{
userId
}
=
props
;
return
(
<
Card
title=
{
`
$
{userId}번 사용자 킥보드 사용 히스토리`
}
ctTableFullWidth
ctTableResponsive
content=
{
<
Table
striped
hover
>
<
thead
>
<
tr
>
{
thArray
.
map
((
prop
,
key
)
=>
{
return
<
th
key=
{
key
}
>
{
prop
}
</
th
>;
})
}
</
tbody
>
</
Table
>
}
/>
);
}
}
</
tr
>
</
thead
>
<
tbody
>
{
tdArray
.
map
((
prop
,
key
)
=>
{
return
(
<
tr
key=
{
key
}
>
{
prop
.
map
((
prop
,
key
)
=>
{
return
<
td
key=
{
key
}
>
{
prop
}
</
td
>;
})
}
</
tr
>
);
})
}
</
tbody
>
</
Table
>
}
/>
);
};
export
default
UserHistoryCard
;
...
...
frontend/src/views/Kickboard.jsx
View file @
49be43f
import
React
from
"react"
;
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
{
Grid
,
Row
,
Col
}
from
"react-bootstrap"
;
import
GoogleMapCard
from
'../components/Kickboard/GoogleMapCard'
;
...
...
@@ -7,6 +7,8 @@ import KickboardHistoryTable from '../components/Kickboard/KickboardHistoryTable
import
SearchButton
from
'../components/Kickboard/SearchButton'
;
const
Kickboard
=
()
=>
{
const
[
kbId
,
setKbId
]
=
useState
(
'000000'
);
// 여기 API 요청
return
(
<
div
className=
"content"
>
...
...
@@ -21,17 +23,17 @@ const Kickboard = () => {
<
GoogleMapCard
/>
</
Col
>
<
Col
md=
{
6
}
>
<
KickboardStatusCard
/>
<
KickboardStatusCard
kbId=
{
kbId
}
/>
</
Col
>
</
Row
>
<
Row
>
<
Col
md=
{
12
}
>
<
KickboardHistoryTable
/>
<
KickboardHistoryTable
kbId=
{
kbId
}
/>
</
Col
>
</
Row
>
</
Grid
>
</
div
>
);
}
}
;
export
default
Kickboard
;
...
...
frontend/src/views/UserHistory.jsx
View file @
49be43f
...
...
@@ -4,8 +4,8 @@ import UserDataCard from '../components/UserHistory/UserDataCard';
import
UserHistoryCard
from
'../components/UserHistory/UserHistoryCard'
;
import
SearchButton
from
"../components/UserHistory/SearchButton"
;
const
UserHistory
=
(
props
)
=>
{
const
[
userId
,
setUserId
]
=
useState
(
'0'
);
const
UserHistory
=
()
=>
{
const
[
userId
,
setUserId
]
=
useState
(
0
);
useEffect
(()
=>
{
// componentDidMount > 쿼리 검사하기
...
...
@@ -21,10 +21,10 @@ const UserHistory = (props) => {
</
Row
>
<
Row
>
<
Col
md=
{
12
}
>
<
UserDataCard
/>
<
UserDataCard
userId=
{
userId
}
/>
</
Col
>
<
Col
md=
{
12
}
>
<
UserHistoryCard
/>
<
UserHistoryCard
userId=
{
userId
}
/>
</
Col
>
</
Row
>
</
Grid
>
...
...
Please
register
or
login
to post a comment