Skip to content

Conversation

@maclovedany
Copy link
Collaborator

기본

  • 중고마켓 페이지 주소는 “/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개 보이기

심화

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

주요 변경사항

  • 스프린트 1~4 React로 변경했습니다.

@maclovedany maclovedany requested a review from dongqui May 15, 2025 17:07
@maclovedany maclovedany added the 순한맛🐑 마음이 많이 여립니다.. label May 15, 2025
Copy link
Collaborator

@dongqui dongqui left a comment

Choose a reason for hiding this comment

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

경훈님 이번 미션도 고생 많으셨습니다~!

요구 사항도 잘 구현해 주셨고 기본적으로 리엑트도 능숙하신 거 같습니다~!
컴포넌트화, 커스텀 훅 정의 등으로 재사용성, 가독성을 고려해 주시면 더욱 좋을 거 같습니다 :)

const API_BASE_URL = "https://panda-market-api.vercel.app/"; // API base URL 업데이트

// 화면 크기 감지 Hook
const useWindowSize = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

커스텀 훅을 잘 정의해 주셨군요! 👍
hooks 폴더에 따로 모아 관리하시면 더욱 좋을 거 같습니다 :)

const [allItems, setAllItems] = useState([]);
const [totalAllItemsCount, setTotalAllItemsCount] = useState(0);
const [currentPage, setCurrentPage] = useState(1);
const [orderBy, setOrderBy] = useState("recent"); // 'recent' or 'favorite'
Copy link
Collaborator

Choose a reason for hiding this comment

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

여유가 되신다면 정렬, 검색, 페이지 값들을 상태가 아니라 url 쿼리스트링으로 관리해 보시면 좋습니다~!

지금은 새로고침을 하거나 브라우저 뒤로가기 버튼 등을 누르면 모든 상태 값이 날라가게 됩니다 😢

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

여유가 되신다면 정렬, 검색, 페이지 값들을 상태가 아니라 url 쿼리스트링으로 관리해 보시면 좋습니다~!

지금은 새로고침을 하거나 브라우저 뒤로가기 버튼 등을 누르면 모든 상태 값이 날라가게 됩니다 😢

네 알겠습니다!

return windowSize;
};

function ItemsPage() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

대체로 기능 자체는 잘 구현해 주셨는데, 하나의 컴포넌트에 너무 많은 로직이 담겨져 있습니다.

관련된 코드를 모아 컴포넌트로 추상화 해보시면 더욱 좋을 거 같습니다!

예를 들면,
bestItems와 관련된 로딩, 에러, 상품 관련 상태 값들과 jsx 부분을 모아 BestItems 컴포넌트로 만들 수 있겠죠!

또한 드랍다운이나 페이지네이션도 상태 값과 jsx를 모아 컴포넌트화 할 수 있을 거에요! :)
지금은 각각의 상태 값이 뒤섞여 있어, 필요한 로직을 찾기가 어려운 느낌이 있습니다..!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵, 컴포넌트화 하도록 하겠습니다!

const mobileSortRef = useRef(null);

// 모바일 외부 클릭 시 드롭다운 닫기
useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 useEffect도 커스텀 훅으로 제작할 수 있겠네요 :)

// params: { page, pageSize, orderBy, keyword }
// setLoading 상태는 각 useEffect에서 호출 전에 직접 관리
setError(null);
let queryParams = `?orderBy=${params.orderBy || "recent"}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

URLSearchParams을 사용하시면 조금 더 쉽게 구현하실 수 있습니다!
https://developer.mozilla.org/ko/docs/Web/API/URLSearchParams#%EC%98%88%EC%A0%9C

import { Link, useNavigate } from "react-router-dom";
import "../auth.css";

function SignupPage() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

부지런히 옮겨주셨군요..!!! 🤣

인풋이 하나 늘 때마다 상태, 유효성 검사 관리가 점점 복잡해지죠..!

react-hook-form, zod를 사용해 보시면 좋습니다 :)

const handleSubmit = (e) => {
e.preventDefault();
const isEmailValid = validateEmail();
const isNicknameValid = validateNickname();
Copy link
Collaborator

Choose a reason for hiding this comment

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

아직 리팩토링 중이시겠지만.. 지금은 상태 값만 따라가도 충분할 거 같네요 :)

)}
</div>
<div className="header-row2">
<form onSubmit={handleSearchSubmit} className="search-form">
Copy link
Collaborator

Choose a reason for hiding this comment

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

image
디자인 시안을 다시 확인해 주세요 :)

)}
</div>
</div>
{loadingAll ? (
Copy link
Collaborator

Choose a reason for hiding this comment

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

현재 페이지 이동을 할 때마다 스크롤이 위로 튀는 현상이 있습니다. 아마 로딩 때 마다 달라지는 UI 때문일 거 같네요 🤔 좋은 UX를 위해 여유가 있으시다면 해결해 보셔도 좋을 거 같습니다 :)

<Header />
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/signin" element={<SigninPage />} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

image
로그인 페이지는 다른 레이아웃을 가질 수 있도록 고려해 주세요 :)

@dongqui dongqui merged commit 2fa2b8a into codeit-bootcamp-frontend:React-차경훈 May 19, 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