Skip to content

Conversation

@sngminn
Copy link
Collaborator

@sngminn sngminn commented Apr 10, 2025

요구사항

기본

상품 등록

  • 상품 등록 페이지 주소는 “/additem” 입니다.
  • 페이지 주소가 “/additem” 일때 상단네비게이션바의 '중고마켓' 버튼의 색상은 “3692FF”입니다.
  • 상품 이미지는 최대 한개 업로드가 가능합니다.
  • 각 input의 placeholder 값을 정확히 입력해주세요.
  • 이미지를 제외하고 input 에 모든 값을 입력하면 ‘등록' 버튼이 활성화 됩니다.
  • API를 통한 상품 등록은 추후 미션에서 적용합니다.

체크리스트 [심화]

상품 등록

  • 이미지 안의 X 버튼을 누르면 이미지가 삭제됩니다.
  • 추가된 태그 안의 X 버튼을 누르면 해당 태그는 삭제됩니다.

주요 변경사항

  • 이전 PR에서의 피드백 반영했습니다.

스크린샷

Screenshot 2025-04-10 at 12 13 32 PM

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

@sngminn sngminn requested a review from dongqui April 10, 2025 06:12
@sngminn sngminn added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Apr 10, 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.

승민님! 이번 미션도 뚝딱 해결하셨군요! 💯
공통 컴포넌트를 더 발전 시켜보시면 더욱 좋을 거 같습니다 :)

<input
type="file"
accept=".png, .jpeg, .jpg"
style={{ display: "none" }}
Copy link
Collaborator

@dongqui dongqui Apr 10, 2025

Choose a reason for hiding this comment

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

hidden 속성을 쓰실 수 있어요! :)

<input hidden />

<CurrentS.File
onClick={(e) => {
e.preventDefault();
setThumbnail("");
Copy link
Collaborator

Choose a reason for hiding this comment

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

인풋에 올라온 파일도 처리해 주셔야합니다~!

title,
width = "100%",
height = "56px",
type = "text",
Copy link
Collaborator

Choose a reason for hiding this comment

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

type은 input이 가지고 있는 고유 html 속성이죠..! 커스텀하여 props로 쓰기에는 부적절합니다.

function A({ as }) {
  const Component = as;
  return <Component />
}

<A as='textarea' />

이런 식으로 쓰실 수 있어요!

Copy link
Collaborator

Choose a reason for hiding this comment

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

이름이 Input인데 textarea까지 사용되는 거는 좀 어색하네요!
input, textarea를 포괄할 수 있는 이름으로 바꾸면 좋을 거 같아요 :)

참고로 MUI에는 TextField가 있습니다!

function handleKeyDown(e) {
if (e.key === "Enter" && currentTag.trim() !== "") {
e.preventDefault();
setTags((prev) => [...prev, currentTag.trim()]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

태그가 중복되어 들어가는데, 이런 경우 Set을 써보셔도 좋습니다 :)

/>
{type === "password" && <ShowPassword />}
<div className="input-container">
<input
Copy link
Collaborator

Choose a reason for hiding this comment

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

사실상 만드신 공통 컴포넌트랑 같은 UI죠!

만들어두신 컴포넌트를 조금 더 확장성 있게 만들고 활용해 봐도 좋을 거 같아요!

function Input({ suffix }) {
  <div>
    <input />
    {suffix}
  </div>
}

이런식으로 아이콘과 로직은 밖에서 받아오는 방법이 있습니다 :)

}

return (
<ParentS.Label>
Copy link
Collaborator

Choose a reason for hiding this comment

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

옆에 빈 공간을 눌러도 파일 업로더가 나옵니다🤣

<span>이미지 등록</span>
</CurrentS.File>
{thumbnail && (
<CurrentS.File
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 41503bd into codeit-bootcamp-frontend:React-김승민 Apr 10, 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