Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
travel
Commits
23965dce
Commit
23965dce
authored
Jul 13, 2022
by
Lee Soobeom
Browse files
.
parent
71aa5b17
Changes
1
Show whitespace changes
Inline
Side-by-side
frontend/src/board/board.tsx
View file @
23965dce
...
@@ -3,18 +3,13 @@ import { Link } from "react-router-dom";
...
@@ -3,18 +3,13 @@ import { Link } from "react-router-dom";
import
{
PostType
}
from
"
../types
"
;
import
{
PostType
}
from
"
../types
"
;
import
Post
from
"
../post/post
"
;
import
Post
from
"
../post/post
"
;
function
range
(
start
:
number
,
end
:
number
)
{
return
new
Array
(
end
-
start
+
1
).
fill
(
undefined
).
map
((
_
,
i
)
=>
i
+
start
);
}
interface
Posts
{
interface
Posts
{
posts
:
PostType
[];
posts
:
PostType
[];
}
}
export
const
fakes
=
[
export
const
fakes
=
[
{
{
id
:
"
a
"
,
userId
:
"
lsb
"
,
username
:
"
lsb
"
,
title
:
"
여행가고싶다...
"
,
title
:
"
여행가고싶다...
"
,
date
:
"
2022-06-30
"
,
date
:
"
2022-06-30
"
,
counts
:
0
,
counts
:
0
,
...
@@ -22,8 +17,7 @@ export const fakes = [
...
@@ -22,8 +17,7 @@ export const fakes = [
city
:
"
seoul
"
,
city
:
"
seoul
"
,
},
},
{
{
id
:
"
b
"
,
userId
:
"
lsb
"
,
username
:
"
lsb
"
,
title
:
"
바다!바다!바다!
"
,
title
:
"
바다!바다!바다!
"
,
date
:
"
2022-08-01
"
,
date
:
"
2022-08-01
"
,
counts
:
0
,
counts
:
0
,
...
@@ -31,8 +25,7 @@ export const fakes = [
...
@@ -31,8 +25,7 @@ export const fakes = [
city
:
"
seoul
"
,
city
:
"
seoul
"
,
},
},
{
{
id
:
"
c
"
,
userId
:
"
lsb
"
,
username
:
"
lsb
"
,
title
:
"
Jeju-island
"
,
title
:
"
Jeju-island
"
,
date
:
"
2022-9-10
"
,
date
:
"
2022-9-10
"
,
counts
:
0
,
counts
:
0
,
...
@@ -40,8 +33,7 @@ export const fakes = [
...
@@ -40,8 +33,7 @@ export const fakes = [
city
:
"
seoul
"
,
city
:
"
seoul
"
,
},
},
{
{
id
:
"
d
"
,
userId
:
"
lsb
"
,
username
:
"
lsb
"
,
title
:
"
마! 부싼 가봤나!
"
,
title
:
"
마! 부싼 가봤나!
"
,
date
:
"
2022-9-22
"
,
date
:
"
2022-9-22
"
,
counts
:
0
,
counts
:
0
,
...
@@ -49,8 +41,7 @@ export const fakes = [
...
@@ -49,8 +41,7 @@ export const fakes = [
city
:
"
seoul
"
,
city
:
"
seoul
"
,
},
},
{
{
id
:
"
e
"
,
userId
:
"
lsb
"
,
username
:
"
lsb
"
,
title
:
"
Daegu
"
,
title
:
"
Daegu
"
,
date
:
"
2022-10-1
"
,
date
:
"
2022-10-1
"
,
counts
:
0
,
counts
:
0
,
...
@@ -58,8 +49,7 @@ export const fakes = [
...
@@ -58,8 +49,7 @@ export const fakes = [
city
:
"
Daegu
"
,
city
:
"
Daegu
"
,
},
},
{
{
id
:
"
f
"
,
userId
:
"
lsb
"
,
username
:
"
lsb
"
,
title
:
"
강원도 감자는 맛있다.
"
,
title
:
"
강원도 감자는 맛있다.
"
,
date
:
"
2022-12-12
"
,
date
:
"
2022-12-12
"
,
counts
:
0
,
counts
:
0
,
...
@@ -67,8 +57,7 @@ export const fakes = [
...
@@ -67,8 +57,7 @@ export const fakes = [
city
:
"
강원도
"
,
city
:
"
강원도
"
,
},
},
{
{
id
:
"
g
"
,
userId
:
"
lsb
"
,
username
:
"
lsb
"
,
title
:
"
부산남자의 서울여행
"
,
title
:
"
부산남자의 서울여행
"
,
date
:
"
2022-12-25
"
,
date
:
"
2022-12-25
"
,
counts
:
0
,
counts
:
0
,
...
@@ -84,7 +73,7 @@ export default function BoardPage() {
...
@@ -84,7 +73,7 @@ export default function BoardPage() {
const
postId
=
event
.
currentTarget
.
id
;
const
postId
=
event
.
currentTarget
.
id
;
const
newposts
=
[...
posts
];
const
newposts
=
[...
posts
];
newposts
.
forEach
((
post
)
=>
{
newposts
.
forEach
((
post
)
=>
{
if
(
post
.
i
d
===
postId
)
{
if
(
post
.
userI
d
===
postId
)
{
post
.
counts
=
post
.
counts
+
1
;
post
.
counts
=
post
.
counts
+
1
;
return
;
return
;
}
}
...
@@ -116,7 +105,11 @@ export default function BoardPage() {
...
@@ -116,7 +105,11 @@ export default function BoardPage() {
</
div
>
</
div
>
<
div
>
<
div
>
{
posts
.
map
((
post
)
=>
(
{
posts
.
map
((
post
)
=>
(
<
Post
key
=
{
post
.
id
}
post
=
{
post
}
handleClick
=
{
titleHandleClick
}
/>
<
Post
key
=
{
post
.
userId
}
post
=
{
post
}
handleClick
=
{
titleHandleClick
}
/>
))
}
))
}
</
div
>
</
div
>
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment