Skip to content

[최권진] sprint6 #126

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

Merged

Conversation

kwonjin2
Copy link
Collaborator

@kwonjin2 kwonjin2 commented Apr 13, 2025

요구사항

기본

상품 등록

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

체크리스트 [심화]

상품 등록

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

주요 변경사항

  • 미션 5 코드리뷰 피드백 반영 -> 리팩토링
  • UX 개선을 위한 Loading / ErrorMessage 컴포넌트 UI 개선 (스켈레톤 UI) -> layout shift 방지

배포 링크

https://panda-market-ten.vercel.app/

멘토에게

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

@kwonjin2 kwonjin2 changed the title [최권진] 미션 6 [최권진] sprint6 Apr 13, 2025
@kwonjin2 kwonjin2 marked this pull request as draft April 13, 2025 08:29
@kwonjin2 kwonjin2 requested a review from dongqui April 13, 2025 08:29
@kwonjin2 kwonjin2 self-assigned this Apr 13, 2025
@kwonjin2 kwonjin2 added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Apr 13, 2025
@kwonjin2 kwonjin2 marked this pull request as ready for review April 13, 2025 12:27
@dongqui dongqui changed the base branch from main to React-최권진 April 14, 2025 06:13
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.

권진님 최근 급격한 성장과 열정이 느껴집니다..! 앞으로도 화이팅입니다!!

+버셀 에러 관련 커밋이 많던데, 실제로 배포하지 않고 로컬에서 npm run build를 해보시면 많은 부분을 해결하실 수 있습니다!

<div className="mb-[24px]">
<label
htmlFor={id}
className="font-[700] text-[18px] text-[#1F2937] block mb-[8px]"
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

Choose a reason for hiding this comment

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

또한 기본적인 디자인 토큰은 tailwind config에 넣어서 쓰시는 것이 좋습니다~!

};
reader.readAsDataURL(file);
}
e.target.value = "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 부분은 이미지를 지우거나, 제출을 완료할 때 들어가야 됩니다~! 지금은 previewUrl만 남고 실제 제출할 데이터는 남지 않게 되네요 🤣

if (e.key === "Enter") {
e.preventDefault();
const trimmed = tagInput.trim();
if (trimmed && !tags.includes(trimmed)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

중복을 걸러낼 때 Set을 써보셔도 좋아요~! :)

</label>
)}
<div className="relative">
{type === "textarea" ? (
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' />

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

...rest
}) => {
return (
<div className={`${hidden ? "hidden" : "mb-[24px]"}`}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

마진의 경우 부모가 조절하는 것이 좋겠습니다~! 간격이 꼭 있을 거란 보장이 없죠 :)

)}
</div>
{error && !hidden && (
<p className="text-red-500 text-sm mt-[4px] ml-[16px]">{error}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

유연하게 잘 설계 해주셨네요!👍

const currentPage = Number(searchParams.get("page")) || 1;
const searchKeyword = searchParams.get("keyword") || "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

금방 뚝딱뚝딱 만드시는군요...! 😮 👍

};

const setSearchKeyword = (newKeyword) => {
setSearchKeyword((prev) => ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

잘못 들어간 거 같네요 🤣


const values = watch();

const allFieldsFilled =
Copy link
Collaborator

Choose a reason for hiding this comment

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

register에 validation을 넣어주셨으면, useForm formState에서 isValid를 사용하실 수 있습니다~
https://www.react-hook-form.com/api/useform/formstate/


const AddItemPage = () => {
const [previewUrl, setPreviewUrl] = useState("");
const [showWarning, setShowWarning] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이미지 관련 상태들은 ImageUploader에 들어가는 것이 좋겠죠~! :)

@dongqui dongqui merged commit c7a8179 into codeit-bootcamp-frontend:React-최권진 Apr 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