-
Notifications
You must be signed in to change notification settings - Fork 2
Seongil week4 hw #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: seongil
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,9 @@ const HomePage = () => { | |
| </div> | ||
| <div className="grid grid-cols-4 px-10 mt-10"> | ||
| {postList.map((post) => ( | ||
| <SmallPost key={post.id} post={post} /> | ||
| <Link to={"/" + post.id}> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๏ฟฝSmallPost ์ปดํฌ๋ํธ ์์ฒด๊ฐ Link๋ก ๊ฐ์ธ์ ธ ์๊ธฐ ๋๋ฌธ์ ์ฌ๊ธฐ์๋ Link๋ก ๊ฐ์ธ์ง ์์๋ ์ปดํฌ๋ํธ๋ฅผ ๋๋ ์ ๋ PostDetailPage๋ก ์ด๋ํฉ๋๋ค !! |
||
| <SmallPost key={post.id} post={post} /> | ||
| </Link> | ||
| ))} | ||
| </div> | ||
| <div className="flex justify-center m-20"> | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๋๋ฌด ์ผ๋ฌด์ง๋ค์ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,48 @@ | ||
| const PostCreatePage = () => { | ||
| return <div>Post Create Page</div>; | ||
| const handleSignUpSubmit = () => { | ||
| alert("๊ฒ์๋ฌผ์ ๋ฑ๋กํฉ๋๋ค"); | ||
| }; | ||
| return ( | ||
| <div className="flex flex-col items-center w-1/2"> | ||
| <h3 className="font-bold text-2xl">๊ฒ์๊ธ ์์ฑ</h3> | ||
| <form className="form gap-2" onSubmit={handleSignUpSubmit}> | ||
| <label required type="text" className="label"> | ||
| ์ ๋ชฉ: | ||
| </label> | ||
| <input | ||
| required | ||
| placeholder="์ ๋ชฉ์ ์์ฑํ์ธ์" | ||
| type="text" | ||
| id="title" | ||
| className="input" | ||
| /> | ||
| <label required className="label"> | ||
| ๋ด์ฉ: | ||
| </label> | ||
| <input | ||
| className="h-64 input" | ||
| placeholder="๋ด์ฉ์ ์์ฑํ์ธ์" | ||
| required | ||
| type="text" | ||
| id="content" | ||
| /> | ||
| <label required className="label"> | ||
| ํ๊ทธ: | ||
| </label> | ||
| <input | ||
| className="input" | ||
| placeholder="ํ๊ทธ๋ฅผ ์ถ๊ฐํ์ธ์" | ||
| type="text" | ||
| id="tag" | ||
| /> | ||
| <div className="flex flex-row items-center gap-5"> | ||
| <button type="submit" className="button mt-7"> | ||
| ์๋ฃ | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default PostCreatePage; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,34 @@ | ||
| import posts from "../data/posts"; | ||
| import { BigPost } from "../components/Posts"; | ||
| import { useParams } from "react-router-dom"; | ||
| import { Link } from "react-router-dom"; | ||
|
|
||
| const PostDetailPage = () => { | ||
| return <div>Post Detail Page</div>; | ||
| const postId = useParams().postId; | ||
| const post = posts.find((post) => post.id === parseInt(postId)); | ||
| const handleDeleteClick = () => { | ||
| alert("์ญ์ "); // TODO: add api call for sign up | ||
| }; | ||
| return ( | ||
| <div> | ||
| <BigPost key={post.id} post={post} /> | ||
| <form> | ||
| <div className="flex flex-row items-center gap-5"> | ||
| <Link to={`/${post.id}/edit`}> | ||
| <button type="submit" className="button mt-7"> | ||
| ์์ | ||
| </button> | ||
| </Link> | ||
| <button | ||
| type="button" | ||
| className="button mt-7" | ||
| onClick={handleDeleteClick} | ||
| > | ||
| ์ญ์ | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default PostDetailPage; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,63 @@ | ||||||
| import posts from "../data/posts"; | ||||||
| import { useParams } from "react-router-dom"; | ||||||
| const PostEditPage = () => { | ||||||
| return <div>Post Edit Page</div>; | ||||||
| const handleSignUpSubmit = () => { | ||||||
| alert("์์ ์๋ฃ"); | ||||||
| }; | ||||||
| const postId = useParams().postId; | ||||||
| const post = posts.find((post) => post.id === parseInt(postId)); | ||||||
| return ( | ||||||
| <div className="flex flex-col items-center w-1/2"> | ||||||
| <h3 className="font-bold text-2xl">๊ฒ์๊ธ ์์ </h3> | ||||||
| <form className="form gap-2" onSubmit={handleSignUpSubmit}> | ||||||
| <label required type="text" className="label"> | ||||||
| ์ ๋ชฉ: | ||||||
| </label> | ||||||
| <input | ||||||
| required | ||||||
| value={post.title} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ด๋ ๊ฒ ์ค์ ํ๋ฉด ์๋ง ๊ฐ ์์ ์ด ์ ๋ ๊ฑฐ์์! defaultValue ์์ฑ์ ์ฌ์ฉํด ๋ด์ ~
Suggested change
|
||||||
| type="text" | ||||||
| id="title" | ||||||
| className="input" | ||||||
| /> | ||||||
| <label required className="label"> | ||||||
| ๋ด์ฉ: | ||||||
| </label> | ||||||
| <input | ||||||
| className="h-64 input" | ||||||
| value={post.content} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ฌ๊ธฐ๋ ๋ง์ฐฌ๊ฐ์ง๋ก defaultValue๋ฅผ ์ฐ๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
Suggested change
|
||||||
| required | ||||||
| type="text" | ||||||
| id="content" | ||||||
| /> | ||||||
| <label required className="label"> | ||||||
| ํ๊ทธ: | ||||||
| </label> | ||||||
| <input | ||||||
| className="input" | ||||||
| placeholder="ํ๊ทธ๋ฅผ ์ถ๊ฐํ์ธ์" | ||||||
| required | ||||||
| type="text" | ||||||
| id="tag" | ||||||
| /> | ||||||
| <div className="w-full flex flex-row justify-left flex-wrap mt-5"> | ||||||
| {post.tags.map((tag) => ( | ||||||
| <div className="gap-0.5"> | ||||||
| <span key={tag.id} className="tag m-1 -mr-px"> | ||||||
| #{tag.content} | ||||||
| </span> | ||||||
| <span className="tag text-xs">X</span> | ||||||
| </div> | ||||||
| ))} | ||||||
| </div> | ||||||
| <div className="flex flex-row items-center gap-5"> | ||||||
| <button type="submit" className="button mt-7"> | ||||||
| ์๋ฃ | ||||||
| </button> | ||||||
| </div> | ||||||
| </form> | ||||||
| </div> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
| export default PostEditPage; | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,32 @@ | ||||||||||||||
| const SignInPage = () => { | ||||||||||||||
| return <div>Sign In Page</div>; | ||||||||||||||
| const handleSignUpSubmit = () => { | ||||||||||||||
| alert("๋ก๊ทธ์ธ ํ๊ธฐ"); // TODO: add api call for sign up | ||||||||||||||
| }; | ||||||||||||||
| return ( | ||||||||||||||
| <div className="flex flex-col items-center w-1/2"> | ||||||||||||||
| <h3 className="font-bold text-2xl">ํ์๊ฐ์ </h3> | ||||||||||||||
| <form className="form gap-2" onSubmit={handleSignUpSubmit}> | ||||||||||||||
| <label htmlFor="email" className="label"> | ||||||||||||||
| *์ด๋ฆ: | ||||||||||||||
| </label> | ||||||||||||||
| <input required type="text" id="username" className="input" /> | ||||||||||||||
|
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ด ๋ถ๋ถ์ ์ฌ์ฉ์๊ฐ ์ด๋ฉ์ผ์ ์ ๋ ฅํ๊ฒ ๋์ด์๋ ๋งํผ ์ฝ๋์๋ ๊ธฐ๋ฅ์ ๋ฐ์ํด์ ์ผ๊ด์ฑ์ ์ ์งํด ์ฃผ๋ ๊ฑด ์ด๋จ๊น์!!
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| <label required htmlFor="username" className="label"> | ||||||||||||||
| *๋น๋ฐ๋ฒํธ: | ||||||||||||||
| </label> | ||||||||||||||
| <input required type="password" id="password" className="input" /> | ||||||||||||||
|
|
||||||||||||||
| <div className="flex flex-row items-center gap-5"> | ||||||||||||||
| <button type="reset" className="button mt-7"> | ||||||||||||||
| ์ด๊ธฐํ | ||||||||||||||
| </button> | ||||||||||||||
| <button type="submit" className="button mt-7"> | ||||||||||||||
| ๋ก๊ทธ์ธ | ||||||||||||||
| </button> | ||||||||||||||
| </div> | ||||||||||||||
| </form> | ||||||||||||||
| </div> | ||||||||||||||
| ); | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| export default SignInPage; | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด ํจ์๋ ์ข์์๋ฅผ ๋๋ฅด๋ ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์ ๋ ํธ์ถ๋๋ ํจ์์ธ๋ฐ์ ! ์ด๋ฐ ์ด๋ฒคํธ ํธ๋ค๋ฌ ํจ์๋ ๋ณดํต handle์ด์ฉ๊ตฌ๋ก ์ด๋ฆ์ ์ง๋ ๊ฒ์ด ์ผ๋ฐ์ ์ ๋๋ค ~ ์ฐธ๊ณ ํด ์ฃผ์ธ์ !