Skip to content

Conversation

@maclovedany
Copy link
Collaborator

요구사항

기본

상품 상세

  • 상품 상세 페이지 주소는 "/items/{productId}" 입니다.
  • response 로 받은 아래의 데이터로 화면을 구현합니다.
    => favoriteCount : 하트 개수
    => images : 상품 이미지
    => tags : 상품태그
    => name : 상품 이름
    => description : 상품 설명
  • 목록으로 돌아가기 버튼을 클릭하면 중고마켓 페이지 주소인 "/items" 으로 이동합니다

상품 문의 댓글

  • 문의하기에 내용을 입력하면 등록 버튼의 색상은 "3692FF"로 변합니다.
  • response 로 받은 아래의 데이터로 화면을 구현합니다
    => image : 작성자 이미지
    => nickname : 작성자 닉네임
    => content : 작성자가 남긴 문구
    => description : 상품 설명
    => updatedAt : 문의글 마지막 업데이트 시간

주요 변경사항

  • 폴더 정리
  • 미션7 기능 구현

멘토에게

  • 리뷰 부탁드립니다.

@maclovedany maclovedany requested a review from dongqui May 21, 2025 16:32
@maclovedany maclovedany added the 순한맛🐑 마음이 많이 여립니다.. label May 21, 2025
Copy link
Collaborator

@dongqui dongqui left a comment

Choose a reason for hiding this comment

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

경훈님 이번 미션도 고생 많으셨습니다~! 👍

관심사 분리를 조금 더 신경 써주시면 더욱 좋을 거 같습니다 :)


return (
<StyledItemCard>
<StyledItemCard onClick={handleClick} style={{ cursor: "pointer" }}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

단순 페이지 이동이라면 Link를 사용해주시는 것이 SEO, 접근성에 좋습니다 :)

return config;
});

// 응답 인터셉터 - 토큰 만료 처리
Copy link
Collaborator

Choose a reason for hiding this comment

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

리프레쉬 토큰도 활용해 주시는군요! 👍

</svg>
);

const KebabMenuButton = styled.button`
Copy link
Collaborator

Choose a reason for hiding this comment

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

리엑트 컴포넌트 내부에 스타일드 컴포넌트를 정의하는 것은 안티패턴입니다! 😢
이렇게 되면 ProductInfo가 렌더링 될 때 마다 새로운 스타일드 컴포넌트를 생성하게 됩니다.

https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method

import React from "react";
import styled from "styled-components";

const Container = styled.div`
Copy link
Collaborator

Choose a reason for hiding this comment

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

크게 중요한 것은 아니지만... 개인적으로는 스타일이 위에 있으면 컴포넌트 내용을 보기 힘들어서 불편한 거 같아요 🤣

const initial = nickname ? nickname[0].toUpperCase() : "?";

// 날짜 포맷팅 함수
const formatDate = (dateString) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

요런 함수들은 utils 같은 곳에 모아두면 더욱 좋겠죠!

label="상품명"
placeholder="상품명을 입력해주세요"
value={formData.title}
onChange={(e) => handleTextChange(e, "title")}
Copy link
Collaborator

Choose a reason for hiding this comment

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

input에 name 속성 같은 것을 넣어주시면 'title'을 따로 넘겨주지 않으셔도 됩니다!

<input name='title' />

function handleChange(e) {
  e.target.name // 'title'
}

};

// 판매가격 입력창 키 입력 이벤트 핸들러
const handlePriceKeyDown = (e) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

onChange에서 다루는 것으로 충분할 거 같습니다 🤔

showMenu: false,
};

setComments([newCommentObj, ...comments]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

댓글을 추가하면, 댓글들을 다시 요청하는 것도 고려해 보시면 좋습니다 :)
만약 여러 사람이 동시에 댓글을 달고 있다고 가정한다면, 지금은 본인의 댓글만 보이게 되죠!

setCommentError(null);

try {
const { data } = await productAPI.getComments(productId, null, 10);
Copy link
Collaborator

Choose a reason for hiding this comment

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

지금은 댓글을 10개만 가져오고 있습니다. 요구사항에는 없지만, 무한스크롤을 제공하는 api입니다. 여유가 되신다면 무한 스크롤을 구현해 보셔도 좋아요 :)




function ProductDetailPage() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

지금도 잘하셨지만, 이 전과 마찬가지로 관심사를 분리해 주시면 더욱 좋겠네요!

코멘트 관련된 모든 부분은 코멘트 컴포넌트로 모아둘 수 있습니다 :)

@dongqui dongqui merged commit ac53012 into codeit-bootcamp-frontend:React-차경훈 May 22, 2025
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