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

Conversation

shimyubin
Copy link

@shimyubin shimyubin commented Mar 11, 2025

react-심유빈-sprint5

스프린트미션 5 작업입니다.

주요 변경사항

  • goods 폴더 추가

요구사항

기본요구사항

공통

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

최대한 할 수 있는 부분까지 했습니다...

@shimyubin shimyubin changed the title React 심유빈 sprint5 [심유빈] sprint5 Mar 11, 2025
@coldplay126 coldplay126 self-requested a review March 12, 2025 09:12
Copy link
Collaborator

@coldplay126 coldplay126 left a comment

Choose a reason for hiding this comment

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

과제 수행하느라 고생 많으셨습니다!
아직 리액트의 사용법이 낯설으실텐데 계속 사용하시다 보면 금방 익숙해지실 겁니다

다음부터는 작업 내용을 확인할 수 있는 배포 URL을 PR 설명에 포함해 주시면 감사하겠습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

현재 루트의 .gitignore에 node_module 폴더를 추가하셨지만 이미 git에서 추적되고 있는 것 같습니다!
이 경우 git의 cached를 삭제 후 다시 컴밋해 보시면 changes에서 node_moules가 제외된걸 확인하실 수 있습니다!

git rm -r --cached .
git add .
git commit -m "fix untrack files"

Copy link
Collaborator

Choose a reason for hiding this comment

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

리액트 프로젝트는 루트 폴더에 설정해 주셔야 합니다!

export const ItemCard = ({ item }) => {
return (
<div className="itemCard">
<img className="itemCardImg" src={item.images[0]} alt={item.name} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

이미지의[0]이 없는 경우를 상정해 방어 코드가 추가되면 좋을 것 같습니다!

Comment on lines +1 to +4
import facebook from "../../sprint/img/ic_facebook.png";
import twitter from "../../sprint/img/ic_twitter.png";
import youtube from "../../sprint/img/ic_youtube.png";
import instagram from "../../sprint/img/ic_instagram.png";
Copy link
Collaborator

Choose a reason for hiding this comment

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

이미지 파일을 상대 경로로 설정해 주셨는데 프로젝트 규모가 커지고 복잡해질수록 상대 경로 사용이 어려워 질 수 있습니다. 한 번 절대 경로로 작성해 보시는걸 연습해 보시는건 어떠실까요?

const dataLoad = async ({ orderBy, page, pageSize, keyword }) => {
const products = await getProducts({ orderBy, page, pageSize, keyword });
setItems(products.list);
setMaxPage(Math.ceil(products.tatalCount / pageSize));
Copy link
Collaborator

Choose a reason for hiding this comment

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

tatalCount는 오타인 것 같습니다!

Comment on lines +42 to +44
useEffect(() => {
dataLoad({ orderBy, page, pageSize, keyword });
}, [orderBy, page, pageSize, keyword]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

useEffect 를 사용하여 의존성 값을 확인하고 있으므로 다른 이벤트 핸들러에서 dataLoad를 호출할 필요가 없습니다!

<img src={SearchIcon} alt="Search Icon" />
<input
placeholder="검색할 상품을 입력해 주세요"
value={keyword}
Copy link
Collaborator

Choose a reason for hiding this comment

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

현재 구현상 keyword에 입력될 때 마다 API를 호출하게 됩니다. 이는 서버에 불필요한 부하를 주고, 유저는 마지막 입력 전 까지 검색결과가 없다는 창을 보게 되 사용성을 떨어트립니다. 별도의 검색 버튼을 만들거나, debounce라는 방식을 도입해 보시면 더욱 좋을 것 같습니다!

const [maxPage, setMaxPage] = useState();
const [isLoading, setIsLoading] = useState(false);
const [keyword, setKeyword] = useState("");
const [pageSize, setPageSize] = 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.

pageSize는 변경하는 함수가 없는 것 같습니다!

@coldplay126 coldplay126 merged commit ba707d5 into codeit-sprint-fullstack:react-심유빈 Mar 12, 2025
1 check passed
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