Skip to content

[정남영] 스프린트미션5#54

Merged
wseungjin merged 11 commits intocodeit-sprint-fullstack:react-정남영from
dudska12:react-정남영
Jun 2, 2025

Hidden character warning

The head ref may contain hidden characters: "react-\uc815\ub0a8\uc601"
Merged

[정남영] 스프린트미션5#54
wseungjin merged 11 commits intocodeit-sprint-fullstack:react-정남영from
dudska12:react-정남영

Conversation

@dudska12
Copy link
Collaborator

@dudska12 dudska12 commented Jun 1, 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값을 적절하게 설정합니다.

주요 변경사항

스크린샷

image
스프린트미션5_1
스프린트미션5_2
스프린트미션5_3

멘토에게

  • 기능적인건 다 완성했는데 홈페이지 UI에 디테일적인면이랑 반응형 쪽을 아직 못한 상태입니다. 최대한 빠르게 작업하여 다시 제출하겠습니다[디테일작업완료]
  • 시간에 쫓기듯이 만드느라 완성도가 좀 조잡합니다...
  • 일단 제 문제점을 말하자면 useState랑 useEffect를 너무 많이 사용한거 같기도하고 , API도 분리안하고 만들었습니다. 그리고 완벽한 페이지네이션 기능을 구현못했고... 또 문제점이 있을까요? 피드백부탁드리겠습니다.
    [검색 시에는 상품 리스트가 올바르게 업데이트되지만, 이후 페이지네이션(예: 다음 페이지 버튼)을 누르면 검색 결과가 아닌 기본 상품 리스트가 다시 렌더링되는 문제가 발생함.]

@dudska12 dudska12 requested a review from wseungjin June 1, 2025 14:25
@dudska12 dudska12 self-assigned this Jun 1, 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 [bestItemCount, setBestItemCount] = useState(4);
const [sort, setSort] = useState("recent");
const [salesItemCount, setSalesItemCount] = useState(10);
const [startPage, setStartPage] = useState(1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이게 왜 있는걸까요? currentPage만 있으면 해결 가능해보입니다.

import CustomButton from "../component/customSelect/customSelect.jsx";

const PandaMaket = () => {
const [bestItemCount, setBestItemCount] = useState(4);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 상태도 필요 없어보입니다.
screenSize를 계속 observe하는 식으로 상태를 만들면 어떻까요?

const PandaMaket = () => {
const [bestItemCount, setBestItemCount] = useState(4);
const [sort, setSort] = useState("recent");
const [salesItemCount, setSalesItemCount] = useState(10);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 상태도 필요 없어보입니다. (2)
screenSize를 계속 observe하는 식으로 상태를 만들면 어떻까요?

const [startPage, setStartPage] = useState(1);
const [currentPage, setCurrentPage] = useState(1);

const [getBestItem, setGetBestItem] = useState([]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

getBestItem 없이 bestItem,setBestItem하면 될거 같아요


const handleSortClick = (option) => {
onChange({
target: { value: option === "최신순" ? "recent" : "favorite" },
Copy link
Collaborator

Choose a reason for hiding this comment

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

이런거 enum타입이던 const 타입이던 따로 관리해주는건 어떨까요
SORT.RECENT = 'recent' 이럭식으로요

const fetchSalesItems = async () => {
try {
const res = await fetch(
`https://panda-market-api.vercel.app/products?page=${currentPage}&pageSize=${salesItemCount}&orderBy=${sort}`
Copy link
Collaborator

Choose a reason for hiding this comment

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

fetch랑 데이터 로직으로 모아서 custom 훅으로 만들어 보는건 어떨까요?

))}
</div>
</div>
</div>
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 51a2103 into codeit-sprint-fullstack:react-정남영 Jun 2, 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