Skip to content
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

[조성빈] sprint5 #134

Conversation

JJOBO
Copy link
Collaborator

@JJOBO JJOBO commented Mar 9, 2025

요구사항

기본요구사항

공통

  • Github에 스프린트 미션 PR을 만들어 주세요.
  • React를 사용해 진행합니다.

중고마켓페이지

  • PC, Tablet, Mobile 디자인에 해당하는 중고마켓 페이지를 만들어 주세요.

  • 중고마켓 페이지 url path는 별도로 설정하지 않고, '/'에 보이도록 합니다.

  • 상단 네비게이션 바, 푸터는 랜딩 페이지와 동일한 스타일과 규칙으로 만들어주세요.

  • 상품 데이터는 https://panda-market-api.vercel.app/docs/에 명세된 GET 메소드 "/products" 를 활용해주세요.

    • 상품 목록 페이지네이션 기능을 구현합니다.
    • 드롭 다운으로 "최신 순" 또는 "좋아요 순"을 선택해서 정렬을 구현하세요.
    • 상품 목록 검색 기능을 구현합니다.
  • 베스트 상품 데이터는 https://panda-market-api.vercel.app/docs/에 명세된 GET 메소드 "/products"의 정렬 기준 favorite을 사용해주세요.

심화 요구사항

공통

  • 커스텀 hook을 만들어 필요한 곳에 활용해 보세요.

중고마켓페이지

  • 중고 마켓의 카드 컴포넌트 반응형 기준은 다음과 같습니다.

    • 베스트 상품
      • Desktop : 4열
      • Tablet : 2열
      • Mobile : 1열
      • 전체 상품
      • Desktop : 5열
      • Tablet : 3열
      • Mobile : 2열
  • 반응형에 따른 페이지 네이션 기능을 구현합니다.

    • 반응형으로 보여지는 물품들의 개수를 다르게 설정할때 서버에 보내는 pageSize값을 적절하게 설정합니다.

주요 변경사항

스크린샷

멘토에게

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

@JJOBO JJOBO requested a review from reach0908 March 9, 2025 15:07
Copy link
Collaborator

@reach0908 reach0908 left a comment

Choose a reason for hiding this comment

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

제 코드리뷰 앞에 붙어있는 태그들의 의미는 아래와 같습니다.

  • P0 : 꼭 반영해 주세요 (Request Changes) - 이슈가 발생하거나 취약점이 발견되는 케이스 등
  • P1 : 반영을 적극적으로 고려해 주시면 좋을 것 같아요 (Comment)
  • P2 : 이런 방법도 있을 것 같아요~ 등의 사소한 의견입니다 (Chore)

개발하시느라 고생많으셨습니다!

전체적으로 요구사항에 대해서 잘 구현하신 것 같습니다.
남긴 코멘트들이 꼭 해당 파일들이 아니어도 다른 파일들에도 적용될 수 있으니, 코드 전체적으로 리뷰 코멘트들을 반영해보시면 좋을 것 같습니다.

<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P2]

  • 해당 파일에서 챙길 수 있는 SEO 최적화나 웹 접근성 부분들을 공부해보면 나중에 도움이 될 것 같습니다.
    meta description, OG 태그, 기본 언어 설정 등

Comment on lines +13 to +15
const [isTablet, setIsTablet] = useState(
window.innerWidth < TABLET_BREAKPOINT
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P0]
해당 부분에서 초기값이 설정될 때 폰과 모바일 기기에서도 isTablet 값이 true가 될 것 같습니다. AND 연산자를 통해 모바일의 너비보다는 큰 경우를 챙겨주면 좋을 것 같습니다.

Comment on lines +21 to +22
setIsMobile(width < MOBILE_BREAKPOINT);
setIsTablet(width < TABLET_BREAKPOINT);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분도 위에서 언급한 부분과 동일할 것 같네요.

const UsedMarket = () => {
return (
<section>
<div className={styles.used_market__container}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P2]
개인적인 취향의 문제일수도있으나 해당 컴포넌트와 module.scss가 used-market 이라는 점이 인식이 잘되는 경우에는 className을 정의할 때 해당 부분은 제외하고 정의하는 편이 추후 길어지는 className을 대비하여 더 가독성이 좋을 것 같아요.
styles.used_market__container => styels.container

return (
<li key={id} className={styles.item}>
<div className={styles.image_container} style={{ height: `${height}px` }}>
<img src={images[0]} alt={name} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P0]
배열의 0번째에 이미지가 없을 경우의 예외처리를 해주면 좋을 것 같습니다.

Comment on lines +9 to +21
const COMMON_ITEM_HEIGHT = 220;

const PAGE_SIZE = 10;

const ORDER_LIST = ['좋아요순', '최신순'];

const COMMON_ITEM_DATA_PARAM = {
page: 1,
pageSize: PAGE_SIZE,
orderBy: 'favorite',
keyword: '',
};

Copy link
Collaborator

Choose a reason for hiding this comment

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

[P1]
코드 유지보수 측면에서 이렇게 정의된 상수 값들은 프로젝트 src/constants 와 같이 폴더를 만들어서 각 도메인 단위로 사용한다면 같은 도메인 내에서 재사용이 편리하고 추후 수정시 용이합니다.

Comment on lines +20 to +25
const fetchBestItems = async () => {
const response = await productFetch(BEST_ITEM_DATA_PARAM);
setBestItems(response.list);
};

fetchBestItems();
Copy link
Collaborator

Choose a reason for hiding this comment

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

[P0]
async await를 통해 API를 호출하는 경우 try catch로 감싸서 에러 처리를 해주는 것이 좋습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

[P1]
추가로 로딩상태를 추가하여 fetch를 해오는 동안 사용자가 품목들이 불러와지고 있음을 인지시켜주는 것이 좋습니다.
state를 통한 로딩상태와 해당 로딩상태에 맞는 스켈레톤 컴포넌트에 대해서 개발해보면 좋을 것 같습니다.

Comment on lines +21 to +38
const getPageNumbers = () => {
const pageNumbers = [];
const pageGroupSize = 5;

let startPage =
Math.floor((currentPage - 1) / pageGroupSize) * pageGroupSize + 1;
let endPage = Math.min(totalPage, startPage + pageGroupSize - 1);

if (endPage - startPage < pageGroupSize - 1) {
startPage = Math.max(1, endPage - pageGroupSize + 1);
}

for (let i = startPage; i <= endPage; i++) {
pageNumbers.push(i);
}

return pageNumbers;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

질문
해당 부분이 페이지가 많을 때 페이지를 옮기면 제대로 각 페이지의 그룹 단위로 페이지 숫자들이 변경될까요?

@reach0908 reach0908 merged commit 08577ed into codeit-sprint-fullstack:react-조성빈 Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants