Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SicDoRak
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2023_2_WebPromgramming_8
SicDoRak
Commits
566fe5db
Commit
566fe5db
authored
1 year ago
by
Hyun Woo Jeong
Browse files
Options
Downloads
Patches
Plain Diff
postread
parent
5efddd03
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/src/components/MapForLoaction.js
+38
-0
38 additions, 0 deletions
frontend/src/components/MapForLoaction.js
frontend/src/css/Article.css
+5
-1
5 additions, 1 deletion
frontend/src/css/Article.css
frontend/src/pages/PostRead.js
+35
-12
35 additions, 12 deletions
frontend/src/pages/PostRead.js
with
78 additions
and
13 deletions
frontend/src/components/MapForLoaction.js
0 → 100644
+
38
−
0
View file @
566fe5db
import
{
Map
,
MapMarker
}
from
"
react-kakao-maps-sdk
"
;
import
React
,
{
useRef
,
useState
,
useEffect
,
useContext
}
from
'
react
'
;
const
{
kakao
}
=
window
;
function
MapLocator
({
loc
,
keyword
})
{
// 아주대학교를 기본 위치로 설정
const
[
info
,
setInfo
]
=
useState
()
const
[
markers
,
setMarkers
]
=
useState
([])
const
[
pagination
,
setPagination
]
=
useState
()
const
[
map
,
setMap
]
=
useState
()
const
defaultCenter
=
{
lat
:
loc
.
lat
,
lng
:
loc
.
lng
}
return
(
<
div
className
=
"
UserInput
"
>
<
div
style
=
{{
display
:
'
flex
'
}}
>
<
Map
// 지도를 표시할 Container
center
=
{
defaultCenter
}
style
=
{{
// 지도의 크기
width
:
"
300px
"
,
height
:
"
450px
"
}}
onCreate
=
{
setMap
}
isPanto
=
{
true
}
level
=
{
3
}
>
<
MapMarker
position
=
{
defaultCenter
}
>
<
div
style
=
{{
color
:
"
#000
"
}}
>
{
keyword
}
<
/div
>
<
/MapMarker
>
<
/Map
>
<
/div
>
<
/div
>
)
}
export
default
MapLocator
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
frontend/src/css/Article.css
+
5
−
1
View file @
566fe5db
.article
{
background-color
:
#ffffff
;
border
:
2px
solid
gray
;
}
\ No newline at end of file
}
.article
:hover
{
background-color
:
#bbbbbb
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
frontend/src/pages/PostRead.js
+
35
−
12
View file @
566fe5db
import
{
useNavigate
}
from
'
react-router-dom
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
import
React
,
{
useEffect
,
useState
,
useContext
}
from
'
react
'
;
import
Article
from
'
../components/Article.js
'
;
import
{
UserContext
}
from
'
../Context.js
'
;
import
MapLocator
from
'
../components/MapForLoaction.js
'
;
import
axios
from
'
axios
'
;
axios
.
defaults
.
withCredentials
=
true
;
...
...
@@ -10,33 +13,53 @@ function PostRead() {
let
params
=
useParams
();
const
userContext
=
useContext
(
UserContext
);
const
[
article
,
setArticle
]
=
useState
(
null
)
const
navigate
=
useNavigate
();
function
MoveTo
(
link
){
navigate
(
link
)
}
useEffect
(()
=>
{
requestLoadArticleById
(
params
.
id
)
userContext
.
CheckSession
(
)
.
then
((
response
)
=>
{
console
.
log
(
response
)
setArticle
(
response
.
data
)
})
if
(
!
response
.
data
)
{
alert
(
"
세션이 만료되었습니다. 다시 로그인 바랍니다.
"
)
MoveTo
(
'
/login
'
)
}
else
{
return
requestLoadArticleById
(
params
.
id
)
}
})
.
then
((
response
)
=>
{
console
.
log
(
response
)
setArticle
(
response
.
data
)
})
.
catch
((
response
)
=>
{
console
.
log
(
"
error!:LogOut
"
)
console
.
log
(
response
)
})
},
[]);
console
.
log
(
article
);
console
.
log
(
article
?
Object
.
values
(
article
):
"
no
"
);
if
(
article
)
{
return
(
<
div
className
=
"
App
"
>
<
h1
>
포스트
페이지
<
/h1
>
<
div
className
=
"
introduction
"
>
포스트
내용
<
p
>
현재
페이지의
파라미터는
{
params
.
id
}
입니다
.
<
/p
>
<
div
className
=
"
App
"
>
<
div
className
=
"
introduction
"
style
=
{{
display
:
'
flex
'
}}
>
<
MapLocator
loc
=
{{
lat
:
article
.
latitude
,
lng
:
article
.
longitude
}}
keyword
=
{
article
.
keyword
}
><
/MapLocator
>
<
Article
data
=
{
Object
.
values
(
article
)}
><
/Article
>
<
/div
>
댓글창
,
댓글쓰기
,
조와요
누르기
포스트
내용
<
p
>
현재
페이지의
파라미터는
{
params
.
id
}
입니다
.
<
/p
>
<
/div>
)
}
else
{
return
(
<
div
className
=
"
App
"
>
<
h1
>
포스트
페이지
<
/h1
>
<
div
className
=
"
introduction
"
>
포스트
내용
<
p
>
현재
페이지의
파라미터는
{
params
.
id
}
입니다
.
<
/p
>
<
div
className
=
"
introduction
"
style
=
{{
display
:
'
flex
'
}}
>
<
p
>
로딩준
<
/p
>
<
/div
>
<
/div>
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment