Skip to content

[정우진] sprint 5#52

Merged
wseungjin merged 6 commits intocodeit-sprint-fullstack:basic-정우진from
jwj3171:basic-정우진-sprint1
Jun 3, 2025

Hidden character warning

The head ref may contain hidden characters: "basic-\uc815\uc6b0\uc9c4-sprint1"
Merged

[정우진] sprint 5#52
wseungjin merged 6 commits intocodeit-sprint-fullstack:basic-정우진from
jwj3171:basic-정우진-sprint1

Conversation

@jwj3171
Copy link
Collaborator

@jwj3171 jwj3171 commented May 31, 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값을 적절하게 설정합니다.

주요 변경사항

  • useWindowWidth 커스텀hook을 통해 가로px별(1025px 이상 /768~1024px /768px미만) productList 에 나오는 카드 갯수 다르게 지정
  • pagination 기능 구현
  • 검색 기능 구현
  • 로딩시 skeleton UI 적용
  • 엑박 placeholder 적용
  • 상품클릭시 크게보이는 모달 적용

스크린샷

최신순
image

좋아요순
image

태블릿
image

모바일
image

'판다' 검색
image

검색결과 없을때
image

skeleton
image

유효하지 않은 이미지 url 로 인한 엑박 placeholder처리
image

이미지클릭시 미리보기모달
image
상세페이지는 /product/id로 페이지 구성할 예정입니다

멘토에게

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

@jwj3171 jwj3171 requested a review from wseungjin May 31, 2025 12:13
@jwj3171 jwj3171 self-assigned this May 31, 2025
@jwj3171 jwj3171 changed the title feat:Implement marketPage [정우진] sprint 5 May 31, 2025
Copy link
Collaborator

@wseungjin wseungjin left a comment

Choose a reason for hiding this comment

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

이번주 너무 수고 많으셨습니다~

const width = useWindowWidth();

const getVisibleCount = () => {
if (width <= 768) return 1; // Mobile
Copy link
Collaborator

Choose a reason for hiding this comment

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

screenSize enum으로 mobile인걸 관리해주면 어떨까요?

};
fetchBestProducts();
}, []);
const visibleBestProducts = products.slice(0, getVisibleCount());
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

setLoading(false);
}
};
fetchBestProducts();
Copy link
Collaborator

Choose a reason for hiding this comment

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

아예 데이터 자체를 custom hook로 빼는것도 좋아 보입니다~

if (page < totalPages) {
onPageChange(page + 1);
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

페이지네이션 관련 로직을 커스텀 훅으로 빼도 좋을꺼 같네요 ㅎㅎ

import styles from "./productModal.module.css";
import { useEffect } from "react";

const ProductModal = ({ isOpen, onRequestClose, product }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://react.dev/reference/react-dom/createPortal
포탈로 모달을 만들어 보는건 어떨까요?

// src/hooks/useWindowWidth.js
import { useState, useEffect } from "react";

const useWindowWidth = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

favorite: "좋아요순",
};

const MarketPage = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 컴포넌트가 너무 큰거 같아요 좀 로직별로 묶는 커스텀 훅을 구현하면 좋을꺼 같아요

page = 1,
pageSize = 10,
keyword = "",
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.

객체로 받는건 어떨까요?

@wseungjin wseungjin merged commit c132ed0 into codeit-sprint-fullstack:basic-정우진 Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants