Skip to content

Conversation

@ddumini
Copy link
Collaborator

@ddumini ddumini commented May 9, 2025

https://dduminipandamarket.netlify.app/items/819

요구사항

기본

상품 상세

  • 상품 상세 페이지 주소는 "/items/{productId}" 입니다.
  • response 로 받은 아래의 데이터로 화면을 구현합니다.
  • => favoriteCount : 하트 개수
  • => images : 상품 이미지
  • => tags : 상품태그
  • => name : 상품 이름
  • => description : 상품 설명

상품 문의 댓글

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

심화

  • 모든 버튼에 자유롭게 Hover효과를 적용하세요.

주요 변경사항

  • 상품 상세 페이지 UI 구현
  • 상품 상세 페이지 상세 정보, 코멘트 api 연동 및 관련 훅 구현
  • 문의하기 유효성 체크 기능 추가
  • 목록으로 돌아가기 클릭 시 해당 pagenation 위치 복구
  • 게시판 상세에 공통으로 사용될 컴포넌트 재사용성 고려하여 디렉터리 경로 세팅

스크린샷

PC

image

M

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.
  • 미션 6 피드백 전 작업이라 5에서 주신 피드백까지만 적용된 상태입니다.
  • 코멘트 부분 수정하기 및 삭제하기 기능이 디자인에 있는 것 같은데 기본, 심화 요구사항에 따로 없어 추후 구현해보겠습니다!

@ddumini ddumini requested a review from GANGYIKIM May 9, 2025 16:26
@ddumini ddumini self-assigned this May 9, 2025
@ddumini ddumini added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label May 9, 2025
@GANGYIKIM GANGYIKIM changed the base branch from main to React-김수민 May 14, 2025 02:53
Copy link
Collaborator

@GANGYIKIM GANGYIKIM left a comment

Choose a reason for hiding this comment

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

수민님 7주차 미션 제출 고생하셨습니다~
다음 미션도 화이팅이에요!


  • 변수명, 함수명, props 등에서 중복되는 내용들이 있네요. 명명하실 때 신경써주시면 더 깔끔한 코드가 될 것 같아요.
  • 그전 주차 리뷰에서 드린 코멘트와 중복되는 내용은 최대한 지양했습니다~ 참고해주세요.
  • 코멘트 부분 수정하기 및 삭제하기 기능이 디자인에 있는 것 같은데 기본, 심화 요구사항에 따로 없어 추후 구현해보겠습니다!:
    너무 좋은 생각이신 것 같아요~ 해당 기능 구현을 위한 API 가 존재하니 시간이 되실때 추가해보세요 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
현재 위치한 page를 저장해 UX를 향상하려고 시도하신 점 좋습니다.
다만 지금의 경우 전체 목록중 page만을 고려하셔서 동작시 매끄럽지 않은 부분들이 있습니다.
page param이 있는 경우 정렬기준이 defaultValue가 아닐때와 검색어가 입력되는 경우들도 고려하셔서 수정하시면 더 좋을 것 같습니다.

<button className={styles.arrow} onClick={() => currentPage < totalPage && setCurrentPage(currentPage + 1)}>
<button
className={`${styles.arrow} ${currentPage === totalPage ? styles.disabled : ''}`}
onClick={() => currentPage < totalPage && handlePageChange(currentPage + 1)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
특정 조건에서 해당 버튼을 disabled 처리하셨으니 currentPage < totalPage 조건 검사는 불필요합니다~

Suggested change
onClick={() => currentPage < totalPage && handlePageChange(currentPage + 1)}
onClick={() => handlePageChange(currentPage + 1)}

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 칭찬
css 파일을 각각 import 하시는 대신 배럴 파일을 만드셔서 가독성을 높이신 점 좋습니다~

Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
relativeTime 함수를 직접 구현하신 것 좋습니다.
더 정확하게 구현하기 위해서는 브라우저 제공 API인 Intl.RelativeTimeFormat을 활용하실 수 있습니다.
내장 메소드이기에 더 정확하며 로직도 간결해질 수 있습니다~

https://velog.io/@real-bird/JavaScript-Intl.RelativeTimeFormat

<div id='container' className='itemsPage'>
<div className='inner04'>
<ItemDetailTop productId={productId} />
<DetailInquiry label='문의하기' />
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
문의하기 인풋이 "문의하기" 말고 다른 라벨을 받는 경우가 있나요? 없다면 그냥 label을 props으로 받지 않는게 더 좋을 것 같아요.

Comment on lines +6 to +8
const navigate = useNavigate();
const location = useLocation();
const searchParams = new URLSearchParams(location.search);
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
search 값만 필요하니 아래처럼 하시는 것이 더 좋을 것 같아요.
또한 선언만 되고 사용되지 않는 searchParams 변수는 제거하시는 것이 좋습니다~

Suggested change
const navigate = useNavigate();
const location = useLocation();
const searchParams = new URLSearchParams(location.search);
const navigate = useNavigate();
const { search } = useLocation();

Comment on lines +1 to +3
import { useLocation } from 'react-router-dom';
import styles from './styles/DetailBackToListButton.module.css';
import { useNavigate } from 'react-router-dom';
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안

Suggested change
import { useLocation } from 'react-router-dom';
import styles from './styles/DetailBackToListButton.module.css';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
import styles from './styles/DetailBackToListButton.module.css';

Comment on lines +6 to +7
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
API 호출하는 부분에서 loading, error도 그렇고 반복되는 로직들이 보여요~ 이를 공통화하셔도 좋을 것 같아요.
물론 추후 배우실 서버상태관리 라이브러리들을 사용하시면 라이브러리에서 처리해줄테니 참고만 하셔도 됩니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 여담
디자인대로 작업하시고 focus된 것을 알 수 있게 해주신 점 좋아요!
다만 CSS의 :focus 가상 선택자는 마우스로 클릭할 때도 outline을 표시하기 때문에, 마우스 탐색 시에는 불필요하게 보일 수 있어요. 키보드 네비게이션에서만 포커스 스타일이 적용되길 원하신다면 :focus-visible을 사용해 보세요!

Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
메뉴 외의 영역을 눌렀을때도 닫히게 해주시면 더 사용성이 좋아질 것 같아요.

@GANGYIKIM GANGYIKIM merged commit 19a744a into codeit-bootcamp-frontend:React-김수민 May 14, 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