Skip to content

Conversation

@dkslel1225
Copy link
Collaborator

@dkslel1225 dkslel1225 commented May 10, 2025

요구사항

배포 링크

https://react-15-7.netlify.app/

기본

  • 중고마켓 페이지 주소는 “/items” 입니다.
  • 페이지 주소가 “/items” 일때 상단네비게이션바의 '중고마켓' 버튼의 색상은 “3692FF”입니다.
  • 상단 네비게이션 바는 이전 미션에서 구현한 랜딩 페이지와 동일한 스타일로 만들어 주세요.
  • 상품 데이터 정보는 https://panda-market-api.vercel.app/docs/#/ 에 명세된 GET 메소드 “/products” 를 사용해주세요.
  • '상품 등록하기' 버튼을 누르면 “/additem” 로 이동합니다. ( 빈 페이지 )
  • 전체 상품에서 드롭 다운으로 “최신 순”
  • 중고마켓 반응형

베스트 상품

  • Desktop : 4개 보이기
  • Tablet : 2개 보이기
  • Mobile : 1개 보이기

전체 상품

  • Desktop : 10개 보이기
  • Tablet : 6개 보이기
  • Mobile : 4개 보이기

심화

  • [x]페이지 네이션 기능을 구현합니다.

주요 변경사항

스크린샷

데스크탑

image

태블릿

image

모바일

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

@dkslel1225 dkslel1225 requested a review from GANGYIKIM May 10, 2025 17:48
@dkslel1225 dkslel1225 self-assigned this May 10, 2025
@dkslel1225 dkslel1225 added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label May 10, 2025
Copy link
Collaborator

@GANGYIKIM GANGYIKIM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지윤님 5번째 미션 제출 고생하셨습니다~
올려주신 PR 상에서는 반응형 처리가 잘 된것으로 보이네요.
다만 제가 올려주신 배포 주소에서는 잘 동작하지 않아
이를 기준으로 피드백 드렸으니 참고해주세요~
이번에 React 미션 하시느라 고생하셨습니다!

<>
<Nav />
<Routes>
<Route path="/" element={<AddItem />} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 여담
index 속성을 이용해 시작페이지라는 것을 더 명확하게 알 수 있게 하실수도 있습니다~

Suggested change
<Route path="/" element={<AddItem />} />
<Route index element={<AddItem />} />

Comment on lines +28 to +35
<span
onClick={() => navigate("/items")}
style={
location === "/items" || "/additems" ? { color: "#3692FF" } : {}
}
>
중고마켓
</span>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️ 수정요청
사용하고 계신 라우팅 라이브러리에서는 네비게이션에서 사용되는 wrapping된 link 컴포넌트를 제공합니다~
이를 통해 해당 컴포넌트들에서 일반적인 요구사항을 더 쉽게 구현할 수 있고, 컴포넌트의 역할도 더 명확해지니
아래 문서를 읽고 수정해보시면 더 좋겠습니다.

https://reactrouter.com/api/components/NavLink

return (
<nav>
<div className={styles["nav--left"]}>
<div className={styles.logo} onClick={() => navigate("/")}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💊 제안
react router를 사용하시니 이런경우 Link 컴포넌트를 쓰세요~

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️ 수정요청
배포 사이트에서 확인해보면 가로 스크롤이 생기고 반응형 처리가 안 된 것 같아요~
나중에 화면 사이즈가 작아지면 보여지는 상품 개수가 줄고 디자인대로 보일 수 있도록 변경하시면 좋겠네요.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️ 수정요청
components 폴더에 페이지 컴포넌트들도 들어있는데 이는 올바르지 않은 위계인 것 같아요.
pages라는 폴더를 따로 만드시는 것을 추천드려요!

Comment on lines +11 to +17
const [pagesArr, setPagesArr] = useState([]);
useEffect(() => {
const start = pages[0];
const end = pages[1];
const arr = Array.from({ length: end - start + 1 }, (_, i) => start + i);
setPagesArr(arr);
}, [pages]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💊 제안
정적 요소와 동적 요소가 혼합되어 작성되면, 추후 유지보수 시 어디서 무엇이 생성되는지 파악하기 어려울 수 있습니다.
가급적 전체 페이지 버튼들을 한 번에 생성하는 방식-Array.map, Array.from-으로 작성하거나, 최소한 이전 버튼과 나머지 페이지 버튼의 초기화를 일관된 스타일로 통일하면 코드의 가독성을 높일 수 있습니다.

가장 추천드리는 방식은 아래처럼 jsx에서 바로 작성하시는 거에요~

export default function Pagination({
  pages,
  page: selectedPage,
  setPage,
  totalPages,
  setPages,
}) {
  function pagesUpdate(prev, direction) { ... }

  return (
    <div className={styles.pages}>
      <button/>
        {Array.from({ length: end - start + 1 }, (_, i) => start + i).map( page => (
          <button
            key={page}
            onClick={() => setPage(page)}
            className={`${page === selectedPage ? styles.isCurrentPage : ""}`}
          >
            {pageNum}
          </button>
         ))}
      <button/>
    </div>
  );
}

<div className={styles["allItems__header"]}>
<h3 className={styles.title}>전체 상품</h3>
<div className={styles["allItems__controllers"]}>
<input
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💊 제안
요구사항에는 없었지만 상품 검색기능도 구현하시면 더 좋을 것 같아요!

Comment on lines +11 to +18
if (sortIn === "recent" && sort !== "recent") {
setSort("recent");
setPage(1);
} else if (sortIn === "favorite" && sort !== "favorite") {
setSort("favorite");
setPage(1);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💊 제안
로직이 불필요하게 복잡한 것 같아요~ sortIn 즉 선택된 정렬값은 "recent" | "favorite" 이니 아래처럼 작성하셔도 충분합니다.

Suggested change
if (sortIn === "recent" && sort !== "recent") {
setSort("recent");
setPage(1);
} else if (sortIn === "favorite" && sort !== "favorite") {
setSort("favorite");
setPage(1);
}
}
if(sortIn === sort) return; // 기존과 같은 값이 선택될 경우 1페이지로 가는 것을 막기위해
setSort(sortIn);
setPage(1);
}

Comment on lines +21 to +25
{/* // <ImageWithValidation
// styleClass={styleClass}
// imageURL={item.images}
// alt="프로필 이미지"
// /> */}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️ 수정요청
사용하지 않는 코드는 공유될 필요가 없으니 지우고 올려주세요~

Suggested change
{/* // <ImageWithValidation
// styleClass={styleClass}
// imageURL={item.images}
// alt="프로필 이미지"
// /> */}


<div className={styles.item__description}>
<h3 className={styles["item__name"]}>{item.name}</h3>
<p className={styles["item__price"]}>{item.price}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💊 제안
금액의 경우 (,)를 통해 단위가 구분되도록 아래처럼 작성해주세요!

Suggested change
<p className={styles["item__price"]}>{item.price}</p>
<p className={styles["item__price"]}>{item.price.toLocaleString()}</p>

@GANGYIKIM GANGYIKIM merged commit 7c6b183 into codeit-bootcamp-frontend:React-전지윤 May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants