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";
import
{
PostType
}
from
"
../types
"
;
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
{
posts
:
PostType
[];
}
export
const
fakes
=
[
{
id
:
"
a
"
,
username
:
"
lsb
"
,
userId
:
"
lsb
"
,
title
:
"
여행가고싶다...
"
,
date
:
"
2022-06-30
"
,
counts
:
0
,
...
...
@@ -22,8 +17,7 @@ export const fakes = [
city
:
"
seoul
"
,
},
{
id
:
"
b
"
,
username
:
"
lsb
"
,
userId
:
"
lsb
"
,
title
:
"
바다!바다!바다!
"
,
date
:
"
2022-08-01
"
,
counts
:
0
,
...
...
@@ -31,8 +25,7 @@ export const fakes = [
city
:
"
seoul
"
,
},
{
id
:
"
c
"
,
username
:
"
lsb
"
,
userId
:
"
lsb
"
,
title
:
"
Jeju-island
"
,
date
:
"
2022-9-10
"
,
counts
:
0
,
...
...
@@ -40,8 +33,7 @@ export const fakes = [
city
:
"
seoul
"
,
},
{
id
:
"
d
"
,
username
:
"
lsb
"
,
userId
:
"
lsb
"
,
title
:
"
마! 부싼 가봤나!
"
,
date
:
"
2022-9-22
"
,
counts
:
0
,
...
...
@@ -49,8 +41,7 @@ export const fakes = [
city
:
"
seoul
"
,
},
{
id
:
"
e
"
,
username
:
"
lsb
"
,
userId
:
"
lsb
"
,
title
:
"
Daegu
"
,
date
:
"
2022-10-1
"
,
counts
:
0
,
...
...
@@ -58,8 +49,7 @@ export const fakes = [
city
:
"
Daegu
"
,
},
{
id
:
"
f
"
,
username
:
"
lsb
"
,
userId
:
"
lsb
"
,
title
:
"
강원도 감자는 맛있다.
"
,
date
:
"
2022-12-12
"
,
counts
:
0
,
...
...
@@ -67,8 +57,7 @@ export const fakes = [
city
:
"
강원도
"
,
},
{
id
:
"
g
"
,
username
:
"
lsb
"
,
userId
:
"
lsb
"
,
title
:
"
부산남자의 서울여행
"
,
date
:
"
2022-12-25
"
,
counts
:
0
,
...
...
@@ -84,7 +73,7 @@ export default function BoardPage() {
const
postId
=
event
.
currentTarget
.
id
;
const
newposts
=
[...
posts
];
newposts
.
forEach
((
post
)
=>
{
if
(
post
.
i
d
===
postId
)
{
if
(
post
.
userI
d
===
postId
)
{
post
.
counts
=
post
.
counts
+
1
;
return
;
}
...
...
@@ -116,7 +105,11 @@ export default function BoardPage() {
</
div
>
<
div
>
{
posts
.
map
((
post
)
=>
(
<
Post
key
=
{
post
.
id
}
post
=
{
post
}
handleClick
=
{
titleHandleClick
}
/>
<
Post
key
=
{
post
.
userId
}
post
=
{
post
}
handleClick
=
{
titleHandleClick
}
/>
))
}
</
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