-
Notifications
You must be signed in to change notification settings - Fork 23
[전준기] sprint9 #131
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
Open
JeonJun02
wants to merge
1
commit into
codeit-sprint-fullstack:next-전준기
Choose a base branch
from
JeonJun02:next-전준기-sprint9
base: next-전준기
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "next-\uC804\uC900\uAE30-sprint9"
Open
[전준기] sprint9 #131
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,29 @@ import styles from "./Header.module.css"; | |
| import Link from "next/link"; | ||
| import { useRouter } from "next/router"; | ||
| import Image from "next/image"; | ||
| import { useState, useEffect } from "react"; | ||
|
|
||
| function Header() { | ||
| const router = useRouter(); | ||
| const pathname = router; | ||
| const pathname = router.pathname; | ||
| const isItemPage = pathname === "/items"; | ||
| const isFreePage = pathname === "/free"; | ||
|
|
||
| const [accessToken, setAccessToken] = useState(null); | ||
|
|
||
| useEffect(() => { | ||
| // 클라이언트에서만 localStorage를 확인 | ||
| const token = localStorage.getItem("accessToken"); | ||
| setAccessToken(token); | ||
| }, []); | ||
|
|
||
| const handleLogout = () => { | ||
| if (accessToken) { | ||
| localStorage.removeItem("accessToken"); | ||
| setAccessToken(null); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <section className={styles.topNav}> | ||
| <div className={styles.navCon}> | ||
|
|
@@ -38,10 +54,13 @@ function Header() { | |
| </Link> | ||
| </div> | ||
|
|
||
| {/* 글씨 만이 아닌 여백을 클릭해도 링크 이동하기 위함 */} | ||
| <Link href="/login" className={styles.topNavLoginBt}> | ||
| 로그인 | ||
| </Link> | ||
| {accessToken ? ( | ||
|
Collaborator
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. accessToken이 있는지로 로그인이 확인되면 만로된 accessToken일때는 로그인이 되지않은 상태이지만, 여전히 로그인버튼은 노출되지 않을 수 있습니다. |
||
| <div onClick={handleLogout}>테스트</div> | ||
| ) : ( | ||
| <Link href="/login" className={styles.topNavLoginBt}> | ||
| 로그인 | ||
| </Link> | ||
| )} | ||
| </div> | ||
| </section> | ||
| ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,6 @@ | |
| font-weight: bold; | ||
| text-decoration: none; | ||
| } | ||
| .navLinkBt.active { | ||
| .active { | ||
| color: #3692ff; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import styles from "./LikeButton.module.css"; | ||
| import Image from "next/image"; | ||
|
|
||
| export default function LikeButton({ favoriteCount }) { | ||
| return ( | ||
| <button className={styles.likeBt}> | ||
| <div className={styles.btContents}> | ||
| <div className={styles.likeImgBox}> | ||
| <Image fill alt="heart" src="/imgs/ic_heart.png" /> | ||
| </div> | ||
| <div className={styles.likeCount}>{favoriteCount}</div> | ||
| </div> | ||
| </button> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| .likeBt { | ||
| height: 40px; | ||
| background-color: #ffffff; | ||
| border: 1px solid #e5e7eb; | ||
| border-radius: 35px; | ||
| padding: 4px 12px 4px 12px; | ||
| } | ||
|
|
||
| .btContents { | ||
| display: flex; | ||
| gap: 4px; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .likeImgBox { | ||
| position: relative; | ||
| width: 32px; | ||
| height: 32px; | ||
| } | ||
| .likeCount { | ||
| font-size: 16px; | ||
| line-height: 26px; | ||
| font-weight: 500; | ||
| color: #6b7280; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 10 additions & 2 deletions
12
components/InputComment.js → components/comment/InputComment.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import Image from "next/image"; | ||
| import styles from "./NoComment.module.css"; | ||
|
|
||
| export default function NoComment({ isArticle }) { | ||
| return ( | ||
| <div className={styles.noComment}> | ||
| <div className={styles.imgBox}> | ||
| <Image | ||
| fill | ||
| src={ | ||
| isArticle | ||
| ? "/imgs/img_reply_empty.png" | ||
| : "/imgs/img_inquiry_empty.png" | ||
| } | ||
| alt="emptyImg" | ||
| /> | ||
| </div> | ||
| <div className={styles.textCenter}> | ||
| {isArticle ? ( | ||
| <> | ||
| <span> 아직 댓글이 없어요,</span> | ||
| <span> 지금 댓글을 달아보세요!</span> | ||
| </> | ||
| ) : ( | ||
| <span>아직 문의가 없어요</span> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import styles from "./ItemDescription.module.css"; | ||
|
|
||
| export default function ItemDescription({ description, tags }) { | ||
| return ( | ||
| <div className={styles.itemDescriptionBox}> | ||
| {/* 상품 소개 */} | ||
| <div className={styles.itemDescription}> | ||
| <div className={`${styles.descriptionText} ${styles.middleWeight}`}> | ||
| 상품 소개 | ||
| </div> | ||
| <div className={`${styles.descriptionText} ${styles.smallWeight}`}> | ||
| {description} | ||
| {/* .split(".") | ||
| .filter((sentence) => sentence.trim() !== "") // 빈 문장 제거 | ||
| .map((sentence, index) => ( | ||
| <p key={index}>{sentence.trim()}.</p> // 문장을 p 태그로 감쌈 | ||
| ))} */} | ||
| </div> | ||
| </div> | ||
| {/* 상품 태그 */} | ||
| <div className={styles.itemTagBox}> | ||
| <div className={`${styles.descriptionText} ${styles.middleWeight}`}> | ||
| 상품 태그 | ||
| </div> | ||
| <div className={styles.itemTagList}> | ||
| {!tags ? ( | ||
| <div className={styles.itemTag}> 로딩 중입니다 </div> | ||
| ) : tags.length === 0 ? ( | ||
| <div className={styles.itemTag}> 태그가 없습니다 </div> | ||
| ) : ( | ||
| tags.map((tag, index) => { | ||
| <div key={index} className={styles.itemTag}> | ||
| #{tag} | ||
| </div>; | ||
| }) | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
로그아웃 할 때 accessToken은 삭제해주지만 refreshToken은 삭제하지 않은 이유가 있을까요? refreshToken만 있다면 유저는 로그인을 임의로 수행할 수도 있습니다. 로그아웃이란 유저의 세션을 모두 날리는 작업을 의미합니다. 때문에 특별한 의미가 없다면 refreshToken또한 삭제해주시는게 좋을 수 있습니다.
또한 로그인시에 로컬스토리지에 토큰을 넣는 동작을 수행하는데, 이렇게 로그인시에 토큰을 관리하는 로직을 별도의 훅으로 분리해서 동작시킬 수 있습니다. 그렇게 되면 로컬스토리지에 필요한 키값을 내부의 모듈안에서만 관리할 수 있고, 로그인에 필요한 동작들을 모듈화 할 수 있는 장점이 있습니다.