-
Notifications
You must be signed in to change notification settings - Fork 37
[김승석] Sprint11 #319
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
Merged
withyj-codeit
merged 23 commits into
codeit-bootcamp-frontend:Next-김승석
from
kss761036:Next-김승석-sprint11
Mar 4, 2025
The head ref may contain hidden characters: "Next-\uAE40\uC2B9\uC11D-sprint11"
Merged
[김승석] Sprint11 #319
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
592a3d9
feat: 베스트 게시물 기능 추가
c94f749
feat: 게시글 SSR로 작업
7c3cfc5
feat: 게시글 orderBy 기능 작업
498ba56
feat: 게시글 검색 기능 구현
32ae842
feat: 반응형 작업 완료
8d3017f
feat: 반응형 pagesize 작업 및 로딩중, 비어있음 적용
2f83b8f
feat: pagesize 무한스크롤 기능 및 useOutsideClick hook 추가
87d6588
fix: 네트리파이 배포 오류 수정
e8cb077
style: css파일 삭제 후 인라인속성으로 변경
ecc2dbb
fix: 반응형 버그 수정
0011b09
refactor: 날짜포맷 dayjs 라이브러리로 변경
863aca2
pref: boards 데이터 불러오기 성능 개선
406d403
pref: useCallback으로 boards 데이터 불러오기 함수 메모이제이션
3871bf7
style: board 검색 form태그 추가 시멘틱하게 수정
fe6b0f8
feat: 게시글 작성, 게시글 상세 작업완료
ae625b6
refactor: 컴포넌트 분리
a63a913
feat: 입력값 입력 시 버튼 활성화
9fe291d
feat: 반응형 작업완료
5d3c518
fix: 반응형 스타일 수정
59e5603
feat: 회원가입, 로그인 html, css 작성
2777c37
feat: 로그인, 회원가입 기능 작업 완료
eb288f0
Merge branch 'Next-김승석' into Next-김승석-sprint11
kss761036 9ba593a
Merge branch 'Next-김승석' into Next-김승석-sprint11
kss761036 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
Large diffs are not rendered by default.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| .comment { | ||
| padding-right: 30px; | ||
| position: relative; | ||
| padding-bottom: 12px; | ||
| margin-bottom: 24px; | ||
| border-bottom: 1px solid #e5e7eb; | ||
| } | ||
| .comment > h3 { | ||
| font-size: 14px; | ||
| font-weight: 400; | ||
| line-height: 1.7142; | ||
| margin-bottom: 24px; | ||
| } | ||
| .comment > .info { | ||
| display: flex; | ||
| } | ||
| .comment > .info > figure { | ||
| overflow: hidden; | ||
| display: block; | ||
| margin-right: 8px; | ||
| width: 32px; | ||
| height: 32px; | ||
| border-radius: 9999px; | ||
| } | ||
| .comment > .info > figure > img { | ||
| width: 100%; | ||
| height: 100%; | ||
| object-fit: cover; | ||
| } | ||
| .comment > .info > .right { | ||
| font-size: 12px; | ||
| line-height: 1.5; | ||
| } | ||
| .comment > .info > .right > p { | ||
| color: #4b5563; | ||
| margin-bottom: 4px; | ||
| } | ||
| .comment > .info > .right > span { | ||
| display: block; | ||
| color: #9ca3af; | ||
| } |
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,37 @@ | ||
| import formatDateNow from "@/lib/format-data-now"; | ||
| import ToggleMenu from "@/components/toggle-menu"; | ||
| import styles from "./board-comment.module.css"; | ||
| import { Comment } from "../../types"; | ||
|
|
||
| /** | ||
| * 질문하기 | ||
| * Comment 인터페이스의 타입을 전부 사용안했는데 오류가 나지않는 이유?? | ||
| * 예를 들어 createdAt는 ?. 처럼 선택적이 아니지만 오류가 안남 | ||
| */ | ||
|
|
||
| const BoardComment = (props: Comment) => { | ||
| return ( | ||
| <li className={styles.comment}> | ||
| <ToggleMenu /> | ||
| <h3>{props.content}</h3> | ||
| <div className={styles.info}> | ||
| <figure> | ||
| <img | ||
| src={ | ||
| props.writer.image | ||
| ? props.writer.image | ||
| : "/assets/img/icon_my.svg" | ||
| } | ||
| alt={props.writer.nickname} | ||
| /> | ||
| </figure> | ||
| <div className={styles.right}> | ||
| <p>{props.writer.nickname}</p> | ||
| <span>{formatDateNow(props.updatedAt)}</span> | ||
| </div> | ||
| </div> | ||
| </li> | ||
| ); | ||
| }; | ||
|
|
||
| export default BoardComment; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import styles from "./form.module.css"; | ||
|
|
||
| interface Props { | ||
| type: string; | ||
| placeholder: string; | ||
| value?: string; | ||
| name?: string; | ||
| onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
| } | ||
|
|
||
| const FormInput = ({ type, placeholder, value, name, onChange }: Props) => { | ||
| return ( | ||
| <input | ||
| className={styles.input} | ||
| type={type} | ||
| placeholder={placeholder} | ||
| value={value} | ||
| name={name} | ||
| onChange={onChange} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default FormInput; |
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,21 @@ | ||
| import styles from "./form.module.css"; | ||
|
|
||
| interface Props { | ||
| placeholder: string; | ||
| height?: number; | ||
| value?: string; | ||
| onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void; | ||
| } | ||
|
|
||
| const FormTextarea = ({ placeholder, height, value, onChange }: Props) => { | ||
| return ( | ||
| <textarea | ||
| value={value} | ||
| onChange={onChange} | ||
| className={styles.textarea} | ||
| placeholder={placeholder} | ||
| style={{ height: height && `${height}px` }}></textarea> | ||
| ); | ||
| }; | ||
|
|
||
| export default FormTextarea; |
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,52 @@ | ||
| .input { | ||
| display: block; | ||
| background: inherit; | ||
| border: none; | ||
| outline: none; | ||
| box-shadow: none; | ||
| border-radius: 0; | ||
| padding: 0; | ||
| overflow: visible; | ||
| } | ||
| .input { | ||
| width: 100%; | ||
| background-color: #f3f4f6; | ||
| font-size: 16px; | ||
| padding: 0 24px; | ||
| border-radius: 12px; | ||
| height: 56px; | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
| .input::placeholder { | ||
| color: #9ca3af; | ||
| } | ||
|
|
||
| .textarea { | ||
| display: block; | ||
| background: inherit; | ||
| border: none; | ||
| outline: none; | ||
| box-shadow: none; | ||
| border-radius: 0; | ||
| padding: 0; | ||
| overflow: visible; | ||
| resize: none; | ||
| } | ||
| .textarea { | ||
| width: 100%; | ||
| background-color: #f3f4f6; | ||
| font-size: 16px; | ||
| padding: 16px 24px; | ||
| border-radius: 12px; | ||
| height: 282px; | ||
| } | ||
| .textarea::placeholder { | ||
| color: #9ca3af; | ||
| } | ||
|
|
||
| @media (max-width: 744px) { | ||
| .textarea { | ||
| height: 200px; | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |
| } | ||
| .header .my { | ||
| margin-left: auto; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| @media (max-width: 744px) { | ||
|
|
||
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 |
|---|---|---|
| @@ -1,7 +1,30 @@ | ||
| import Link from "next/link"; | ||
| import styles from "./header-layout.module.css"; | ||
| import { useEffect, useState } from "react"; | ||
| import { useRouter } from "next/router"; | ||
|
|
||
| export default function HeaderLayout() { | ||
| const [isLoggedIn, setIsLoggedIn] = useState(false); | ||
| const router = useRouter(); | ||
|
|
||
| useEffect(() => { | ||
| const accessToken = localStorage.getItem("accessToken"); | ||
| if (accessToken) { | ||
| setIsLoggedIn(true); | ||
| } | ||
| }, [router.pathname]); | ||
|
|
||
| const onLogout: React.MouseEventHandler<HTMLDivElement> = () => { | ||
| const result = confirm("로그아웃 하시겠습니까?"); | ||
| if (result) { | ||
| localStorage.removeItem("accessToken"); | ||
| localStorage.removeItem("refreshToken"); | ||
| localStorage.removeItem("user"); | ||
| setIsLoggedIn(false); | ||
| } else { | ||
| return; | ||
| } | ||
|
Comment on lines
+19
to
+26
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. if(!result) return;
localStorage.removeItem("accessToken");
localStorage.removeItem("refreshToken");
localStorage.removeItem("user");
setIsLoggedIn(false);이런식으로 early return기법을 사용해보는건 어떨까요 |
||
| }; | ||
| return ( | ||
| <header className={styles.header}> | ||
| <div className="inner"> | ||
|
|
@@ -27,9 +50,15 @@ export default function HeaderLayout() { | |
| <Link href="">중고마켓</Link> | ||
| </li> | ||
| </ul> | ||
| <Link className={styles.my} href=""> | ||
| <img src="/assets/img/icon_my.svg" alt="마이페이지" /> | ||
| </Link> | ||
| {isLoggedIn ? ( | ||
| <div className={styles.my} onClick={onLogout}> | ||
| <img src="/assets/img/icon_my.svg" alt="마이페이지" /> | ||
| </div> | ||
| ) : ( | ||
| <Link href="/login" className={`btn ${styles.my}`}> | ||
| 로그인 | ||
| </Link> | ||
| )} | ||
| </div> | ||
| </header> | ||
| ); | ||
|
|
||
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,31 @@ | ||
| import { useState } from "react"; | ||
| import styles from "./toggle.menu.module.css"; | ||
| import { useOutsideClick } from "@/hooks/useOutsideClick"; | ||
|
|
||
| const ToggleMenu = () => { | ||
| const [menu, setMenu] = useState(false); | ||
|
|
||
| const onMenuToggle = () => { | ||
| setMenu(!menu); | ||
| }; | ||
|
|
||
| const ref = useOutsideClick(() => { | ||
| setMenu(false); | ||
| }); | ||
|
|
||
| return ( | ||
| <div className={styles.menu}> | ||
| <p onClick={onMenuToggle} ref={ref}> | ||
| <img src="/assets/img/icon_dot.svg" alt="메뉴버튼" /> | ||
| </p> | ||
| {menu && ( | ||
| <ul> | ||
| <li>수정하기</li> | ||
| <li>삭제하기</li> | ||
| </ul> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default ToggleMenu; |
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 @@ | ||
| .menu { | ||
| position: absolute; | ||
| top: 0; | ||
| right: 0; | ||
| } | ||
| .menu > p { | ||
| cursor: pointer; | ||
| } | ||
| .menu > ul { | ||
| position: absolute; | ||
| top: calc(100% + 5px); | ||
| right: 0; | ||
| z-index: 10; | ||
| width: 100px; | ||
| text-align: center; | ||
| border: 1px solid #e5e7eb; | ||
| background-color: #fff; | ||
| padding: 5px 0; | ||
| border-radius: 12px; | ||
| } | ||
| .menu > ul > li { | ||
| padding: 5px 0; | ||
| font-size: 14px; | ||
| cursor: pointer; | ||
| } |
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.
이렇게props를 넘긴다면 보다 확장성 있겠죠?