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 #40

Open
wants to merge 18 commits into
base: react-조형민
Choose a base branch
from

Conversation

paengdal
Copy link
Collaborator

@paengdal paengdal commented Nov 26, 2024

👉 조형민 vercel

요구사항

기본 요구사항

공통

  • 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값을 적절하게 설정합니다.

주요 변경사항

  • 없음

스크린샷

  • 없음

멘토에게

  • 컴포넌트 단위를 어느 정도로 자르는게 적절한지 감이 잘 안 잡힙니다. 가능하면 작게작게 다 나누는게 좋을까요? 🤔🫡

@paengdal paengdal requested a review from seobew November 26, 2024 06:17
@paengdal paengdal self-assigned this Nov 26, 2024
@paengdal paengdal added 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. 최종 제출 스프린트미션 최종 제출본입니다. labels Nov 26, 2024
Copy link
Collaborator

@seobew seobew left a comment

Choose a reason for hiding this comment

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

형민님 고생많으셨습니다.
전반적으로 잘해주셨습니다! 이것저것 많이 시도하신게 정말 좋네요 ㅎㅎ
컴포넌트 같은 경우 코멘트에도 남겨놨지만, 많이 나누다보면 저절로 감이 올것이지만
제가 PR에서 이건 나누면 좋겠습니다 라고 계속 코멘트 드릴게요!

수고하셨습니다 ㅎㅎ

const [page, setPage] = useState(1);
const [maxPage, setMaxPage] = useState(0);
const [loadingError, setloadingError] = useState(null);
const { isTablet, isMobile } = useDeviceSize();
Copy link
Collaborator

Choose a reason for hiding this comment

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

오.. 저도 비슷하게 쓰고 있는데, 좋습니다 👍

setloadingError(null);
result = await getProducts(options);
} catch (error) {
setloadingError(error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서 실패하면, return 해줘도 될것 같아요! result는 undefined일거라 아래쪽

const { list, totalCount } = result;

실행하면 에러가 날거라서요!

Copy link
Collaborator Author

@paengdal paengdal Dec 3, 2024

Choose a reason for hiding this comment

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

앗 그러네요! PR merge후 수정하겠습니다. 안 그러면 또 conflict… 😳

import "./DropDown.css";

export const DropDownMenu = ({ onSelect }) => {
const MENU_TEXT = ["최신순", "좋아요순"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

요렇게 바꾸는게 더 좋을듯 합니다.
if textContent로 하면 좀 모호한듯합니다~

const MENU_ITEMS = [
    { text: "최신순", value: "recent" },
    { text: "좋아요순", value: "favorite" },
  ];

  const handleClick = (value) => () => {
    onSelect(value);
  };

  return (
    <div className="dropdown-menu">
      {MENU_ITEMS.map(({ text, value }) => (
        <div
          className="dropdown-item"
          key={value}
          onClick={handleClick(value)}
        >
          {text}
        </div>
      ))}
    </div>
  );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

헛..onClick에서 왜 함수 실행값을 전달하지 했더니..고차함수인가요? 이것도 나중에 더 연구해보고 적용해보겠습니다. ^^

};

const handleBlur = () => {
setTimeout(() => {
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 Author

Choose a reason for hiding this comment

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

소스구현 찾아보다가 본거라 ㅎㅎ 감사합니다~ 😄

display: none;
}

#logoM {
Copy link
Collaborator

Choose a reason for hiding this comment

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

요렇게 해도 좋기는 한데, mobile이라는 class를 넣고
모바일에서 보여줘야하는 태그들에 다 붙여놓습니다.

그리고 mobile이 아니면 display none, 맞다면 display block으로 한꺼번에 처리하는 방법도 있을것 같아요~


function PaginationButton({ isArrow = false, index, currentPage, onClick }) {
const handleClick = () => {
if (isArrow) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

페이지 컴포넌트와 화살표 컴포넌트를 분리하는게 더 좋은듯 합니다!

이렇게 분기 처리를 하게 되면 이 컴포넌트가 너무 많은 일을 하고 있는듯 해요 ㅎㅎ
아래 if 로 return 하는 것도 그렇고요!

이런것까지 컴포넌트를 나눠야하나? 를 몇번 나누다보면 더 편리해지고 어디까지 나눠야하나 감이 잡힙니다 ㅎㅎ

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ㅎㅎㅎ재사용 가능한거면 다 조건으로 만들려고 하는 강박(?)이 좀 있는 듯합니다. 😭
다음부턴 역할과 분기 처리에 대해 좀 더 고민해보고 만들어 보겠습니다!

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