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
528c5eda
Commit
528c5eda
authored
1 year ago
by
Hyun Woo Jeong
Browse files
Options
Downloads
Patches
Plain Diff
댓글 컴포넌트 생성, 작업 중
parent
566fe5db
No related branches found
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/Comments.js
+33
-0
33 additions, 0 deletions
frontend/src/components/Comments.js
frontend/src/css/Article.css
+1
-1
1 addition, 1 deletion
frontend/src/css/Article.css
frontend/src/pages/PostRead.js
+27
-22
27 additions, 22 deletions
frontend/src/pages/PostRead.js
with
61 additions
and
23 deletions
frontend/src/components/Comments.js
0 → 100644
+
33
−
0
View file @
528c5eda
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
"
../css/Article.css
"
import
{
Routes
,
Route
,
Link
,
useNavigate
,
Navigate
}
from
'
react-router-dom
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
function
Comments
({
data
})
{
const
[
_id
,
title
,
content
,
images
,
author
,
keyword
,
latitude
,
longitude
,
comments
,
likes
,
createdAt
]
=
data
;
const
navigate
=
useNavigate
();
function
MoveTo
(
link
){
navigate
(
link
)
}
let
listItem
=
[]
listItem
=
comments
.
map
((
el
)
=>
{
// http://localhost:8080/uploads/21701487062905.png
return
(
<
p
>
코맨트
테스트
<
/p
>
)});
return
(
<
div
class
=
"
comment
"
>
<
p
>
{
'
코맨트 테스트{
'
}
<
/p
>
<
p
>
{
listItem
}
<
/p
>
<
p
>
{
'
}코맨트 테스트
'
}
<
/p
>
<
/div
>
);
}
export
default
Comments
;
This diff is collapsed.
Click to expand it.
frontend/src/css/Article.css
+
1
−
1
View file @
528c5eda
...
...
@@ -4,5 +4,5 @@
}
.article
:hover
{
background-color
:
#
bbbbbb
;
background-color
:
#
dddddd
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
frontend/src/pages/PostRead.js
+
27
−
22
View file @
528c5eda
...
...
@@ -4,7 +4,7 @@ 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
Comments
from
'
../components/Comments.js
'
;
import
axios
from
'
axios
'
;
axios
.
defaults
.
withCredentials
=
true
;
...
...
@@ -39,33 +39,38 @@ function PostRead() {
},
[]);
console
.
log
(
article
);
console
.
log
(
article
?
Object
.
values
(
article
):
"
no
"
);
if
(
article
)
{
return
(
<
div
className
=
"
App
"
>
if
(
article
)
{
return
(
<>
<
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
>
<
Article
data
=
{
Object
.
values
(
article
)}
><
/Article
>
<
button
>
조와요
<
/button
>
<
/div
>
<
/div
>
댓글창
,
댓글쓰기
,
조와요
누르기
포스트
내용
<
p
>
현재
페이지의
파라미터는
{
params
.
id
}
입니다
.
<
/p
>
<
/div>
)
}
else
{
return
(
<
div
className
=
"
App
"
>
<
h1
>
포스트
페이지
<
/h1
>
<
div
className
=
"
introduction
"
style
=
{{
display
:
'
flex
'
}}
>
<
p
>
로딩준
<
/p
>
<
/div
>
<
/div>
)
}
<
form
>
<
div
style
=
{{
display
:
'
flex
'
}}
>
<
button
>
댓글
작성
<
/button
>
<
input
type
=
"
text
"
><
/input
>
<
/div
>
<
/form>
<
Comments
data
=
{
Object
.
values
(
article
)}
><
/Comments>
<
/
>
)
}
else
{
return
(
<
div
className
=
"
introduction
"
style
=
{{
display
:
'
flex
'
}}
>
<
p
>
로딩준
<
/p
>
<
/div
>
)
}
;
}
async
function
requestLoadArticleById
(
id
)
{
...
...
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