-
Notifications
You must be signed in to change notification settings - Fork 39
[김서연] Sprint6 #191
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
[김서연] Sprint6 #191
The head ref may contain hidden characters: "React-\uAE40\uC11C\uC5F0-sprint6"
Conversation
GANGYIKIM
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서연님 6주차 미션 작업 고생하셨습니다!
저는 폼과 인풋을 다루는 것이 가장 어렵다고 생각하는데 잘 작업하셨어요!
시간이 되시면 요구사항외의 사용성 개선에 대해서도 고민해보시고 작업해보시면 더 좋을 것 같아요.
다음 미션도 화이팅입니다~
| </div> | ||
| <input | ||
| type="file" | ||
| accept="image/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
input의 accept 속성은 유저가 어떤 파일을 올려야하는지에 대한 힌트를 제공하는 속성입니다.
유저는 파일 업로드시 accept의 명시된 확장자 이외의 파일도 올릴 수 있으므로
실제 upload 함수에서 한번더 확장자를 검사해주시는 것이 좋습니다.
(사용자가 업로드창에서 옵션을 열어 확장자를 바꾸면 아래처럼 보입니다)

https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/accept
|
|
||
| {preview && ( | ||
| <div className={styles.imagePreviewBox}> | ||
| <button className={styles.deleteButton} onClick={handleDelete}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❗️ 수정요청
버튼 타입을 적지 않으시면 reset을 기본값으로 가지게 됩니다~ 늘 명시해주시면 좋습니다.
| <button className={styles.deleteButton} onClick={handleDelete}> | |
| <button type="button" className={styles.deleteButton} onClick={handleDelete}> |
| import styles from "./styles/ProductImg.module.css"; | ||
|
|
||
| export default function ProductImg({ preview, setPreview }) { | ||
| const inputRef = useRef(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
ref가 사용되지 않고 있어서 없어도 될 것 같아요~ 추후 필요하실 때 사용하시는 것을 추천드리겠습니다.
| <header> | ||
| <Banner /> | ||
| </header> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
header가 특정 페이지들에서 동일하게 들어가므로 이런 경우 page에서 구현하시기 보다 route에서 처리하시는 것이 관리 및 성능 측면에서 좋습니다.
인덱스, 로그인과 회원가입, 그외 이렇게 경우에 따라 header가 다르게 보이므로 문서를 참고하셔서 수정해보세요~
https://reactrouter.com/start/declarative/routing#layout-routes
| <h2 className={styles.title}>상품 소개</h2> | ||
| <textarea | ||
| className={styles.inputDescription} | ||
| placeholder="상품 소개를 입력해주세요" | ||
| value={description} | ||
| onChange={(e) => setDescription(e.target.value)} | ||
| ></textarea> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
label 태그로 하셔서 input과 연결하시면 더 좋을 것 같아요.
| <h2 className={styles.title}>상품 소개</h2> | |
| <textarea | |
| className={styles.inputDescription} | |
| placeholder="상품 소개를 입력해주세요" | |
| value={description} | |
| onChange={(e) => setDescription(e.target.value)} | |
| ></textarea> | |
| <label htmlFor="description" className={styles.title}>상품 소개</label> | |
| <textarea | |
| id="description" | |
| className={styles.inputDescription} | |
| placeholder="상품 소개를 입력해주세요" | |
| value={description} | |
| onChange={(e) => setDescription(e.target.value)} | |
| /> |
| <main className={styles.container}> | ||
| <section className={styles.addContainer}> | ||
| <h1 className={styles.addTitle}>상품 등록하기</h1> | ||
| <button disabled={!isFormValid} className={styles.addBtn} type="submit"> | ||
| 등록 | ||
| </button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
기존 작업하셨던 로그인, 회원가입 페이지처럼 form 요소를 사용하시면 UX측면에서도 좋고, form 단위로 조작하기도 좋습니다~
- form으로 input과 button을 포함하게 되면, 해당 form의 상호작용가능한 자식요소에서 onsubmit 이벤트가
발생시 form이 이를 감지할 수 있고, 유저입장에서 enter 키를 눌렀을 때 onsubmit 이벤트가 제출되므로 UX 적으로도 좋습니다.
// case1: form에 onsubmit 이벤트 명시
<form class="login-form" onsubmit="login">
<input /> // input에서 enter 키 입력시 onsubmit 이벤트 실행
<button type="submit">login</button> // 해당 버튼 클릭 시 onsubmit 이벤트 실행
</form>
// case2: submit 버튼에 onclick 이벤트 명시
<form class="login-form">
<input /> // input에서 enter 키 입력시 button의 onclick 이벤트 실행
<button type="submit" onClick="login">login</button>
</form>| const isFormValid = | ||
| productName && description && price && tags.length > 0 && imagePreview; | ||
|
|
||
| const handleKeyDown = (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
중복되는 태그가 생성되지 않도록 해주신 점 좋습니다!
다만 이렇게 되면 사용자가 해당 동작에 대한 피드백을 받지 못하므로, alert, toast, input error 와 같은 방식으로 피드백을 주시면 더 좋을 것 같아요.
|
|
||
| <section className={styles.contentContainer}> | ||
| <h2 className={styles.title}>태그</h2> | ||
| <input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❗️ 수정요청
한글로된 태그를 생성할 때 두번 입력이 발생하는 것 같은 현상이 있습니다. 이는 자모음으로 이루어진 한글을 입력중에 발생하는 현상입니다~
배포사이트에서 한글로 태그를 생성해보시고, 위의 동작을 고쳐보세요~
요구사항
배포주소
https://sprint-mission6-pandamarket.netlify.app/item/additem
기본
상품 등록
심화
상품 등록
주요 변경사항
스크린샷
멘토에게