경북대 FE_이은경 4주차 Step2#81
Open
dmsrud1218 wants to merge 13 commits intokakao-tech-campus-2nd-step2:dmsrud1218from
Open
경북대 FE_이은경 4주차 Step2#81dmsrud1218 wants to merge 13 commits intokakao-tech-campus-2nd-step2:dmsrud1218from
dmsrud1218 wants to merge 13 commits intokakao-tech-campus-2nd-step2:dmsrud1218from
Conversation
sjoleee
approved these changes
Jul 20, 2024
sjoleee
left a comment
There was a problem hiding this comment.
고생하셨습니다~! 리뷰 남깁니다.
현재 step1의 내용과 충돌이 발생했는데 한 번 해결해보시면 좋을 것 같습니다
| textAlign="center" | ||
| width="50px" | ||
| /> | ||
| <Button onClick={() => handleQuantityChange(quantity + 1)}>+</Button> |
| <Text>카톡 친구가 아니어도 선물 코드로 선물할 수 있어요!</Text> | ||
| </Text> | ||
| <QuantityWrapper> | ||
| <Button onClick={() => handleQuantityChange(quantity - 1)}>-</Button> |
| alert('현금영수증 번호를 입력해주세요!'); | ||
| return; | ||
| } | ||
| if (cashReceipt && !/^\d+$/.test(cashReceiptNumber)) { |
There was a problem hiding this comment.
유효성 검사에서 정규식을 사용할때는 별도의 변수로 사용해주시면 좋을 것 같아요. 정규식만 봐서는 무엇을 위한 건지 파악하기 어려울 때가 많아서요!
Comment on lines
+17
to
+32
| if (message.length === 0) { | ||
| alert('카드 메시지를 입력해주세요!'); | ||
| return; | ||
| } | ||
| if (message.length > 100) { | ||
| alert('카드 메시지는 100자 이내로 입력해주세요!'); | ||
| return; | ||
| } | ||
| if (cashReceipt && cashReceiptNumber.length === 0) { | ||
| alert('현금영수증 번호를 입력해주세요!'); | ||
| return; | ||
| } | ||
| if (cashReceipt && !/^\d+$/.test(cashReceiptNumber)) { | ||
| alert('현금 영수증 번호는 숫자만 입력해주세요!'); | ||
| return; | ||
| } |
There was a problem hiding this comment.
유효성 검사를 하는 함수를 별도로 분리할 수도 있을 것 같네요! 현재는 alert의 메시지가 한글로 작성되어 있어 크게 문제가 될 것 같지는 않지만 많은 검사를 수행해야하거나, 별도의 메시지가 없는 경우에는 각 조건이 어떤 의미를 담는지 파악하기 쉬우면 좋을 것 같아요!
예를 들면, isNotEmptyString(message)나 isOnlyNumber(cashReceiptNumber) 같은 함수를 만들면 좋지 않을까 싶네요!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
안녕하세요 멘토님!
사실 step1에서 ui 구현에 어려움을 겪는다면 임의로 변경해도 된다고 하셔서 임의로 했었는데 이번은 수정을 하여서 버튼과 수량입력칸 등 조금 더 수정하였습니다!
매번 꼼꼼한 리뷰 감사합니다!