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
63a67026
Commit
63a67026
authored
Jul 04, 2022
by
Lee Soobeom
Browse files
button id
parent
a172de22
Changes
2
Show whitespace changes
Inline
Side-by-side
frontend/src/Pages/post.tsx
View file @
63a67026
import
React
,
{
useState
}
from
"
react
"
;
export
interface
PostType
{
id
:
string
;
title
:
string
;
date
:
string
;
click
:
number
;
}
import
{
PostType
}
from
"
./typesrc
"
;
type
Props
=
{
post
:
PostType
;
...
...
@@ -17,7 +11,7 @@ export default function Post({ post }: Props) {
return
(
<
div
className
=
"flex flex-row h-16 divide-x-2 border-2 border-solid"
>
<
div
className
=
"basis-full"
>
<
button
onClick
=
{
()
=>
setCount
(
count
+
1
)
}
>
{
post
.
title
}
</
button
>
<
button
id
=
{
post
.
id
}
onClick
=
{
()
=>
setCount
(
count
+
1
)
}
>
{
post
.
title
}
</
button
>
</
div
>
{
/*<Link to>title</Link> */
}
<
div
className
=
"basis-3/12"
>
{
post
.
date
}
</
div
>
<
div
className
=
"basis-2/12"
>
{
count
}
</
div
>
...
...
frontend/src/pages/board.tsx
View file @
63a67026
import
React
,
{
useState
}
from
"
react
"
;
import
Post
,
{
PostType
}
from
"
./post
"
;
import
React
,
{
useState
,
MouseEvent
}
from
"
react
"
;
import
{
PostType
}
from
"
./typesrc
"
;
import
Post
from
"
./post
"
;
function
range
(
start
:
number
,
end
:
number
)
{
return
(
new
Array
(
end
-
start
+
1
)).
fill
(
undefined
).
map
((
_
,
i
)
=>
i
+
start
);
...
...
@@ -15,6 +16,10 @@ export default function BoardPage() {
const
[
posts
,
setPosts
]
=
useState
<
PostType
[]
>
(
fakes
);
// const titleHandleClick = (event:MouseEvent<HTMLButtonElement>) => {
// setPosts( posts)
// }
return
(
<
div
className
=
"flex flex-col items-center"
>
<
div
className
=
"flex flex-col items-center mt-6"
>
...
...
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