-
Notifications
You must be signed in to change notification settings - Fork 26
[김원선]sprint4 #80
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
The head ref may contain hidden characters: "Basic-\uAE40\uC6D0\uC120-sprint4"
[김원선]sprint4 #80
Changes from all commits
d0e8e05
2c24e7c
d6e8818
d7dd3af
8f150ea
9384254
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,3 +88,9 @@ acronym { | |
| a { | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| button { | ||
| cursor: pointer; | ||
| border: none; | ||
| background-color: transparent; | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,15 +6,14 @@ | |||||||||
| <title>판다마켓</title> | ||||||||||
| <meta property="og:title" content="판다마켓" /> | ||||||||||
| <meta property="og:description" content="일상의 모든 물건을 거래해보세요" /> | ||||||||||
| <meta property="og:image" content="./image/Landing_Page_img" /> | ||||||||||
| <meta property="og:url" content="pandamakert.netlify.app" /> | ||||||||||
| <meta property="og:image" content="/image/Landing_Page_img.png" /> | ||||||||||
| <meta property="og:url" content="http://pandamakert.netlify.app" /> | ||||||||||
|
Comment on lines
+9
to
+10
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 굿굿 ! 메타 태그를 적절하게 수정하셨군요 ! 👍
Suggested change
그런데 프로토콜에 |
||||||||||
| <link rel="stylesheet" href="css/style.css" /> | ||||||||||
| <link rel="stylesheet" href="css/reset.css" /> | ||||||||||
| <link | ||||||||||
| rel="stylesheet" | ||||||||||
| type="text/css" | ||||||||||
| href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" | ||||||||||
| /> | ||||||||||
| href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" /> | ||||||||||
| </head> | ||||||||||
| <body> | ||||||||||
| <!-- Header --> | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,88 @@ | ||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||
| form, | ||||||||||||||||||||||||||
| userEmail, | ||||||||||||||||||||||||||
| userPassword, | ||||||||||||||||||||||||||
| submitButton, | ||||||||||||||||||||||||||
| emailErrorMsg, | ||||||||||||||||||||||||||
| pwErrorMsg, | ||||||||||||||||||||||||||
| pwToggle, | ||||||||||||||||||||||||||
| errMsg, | ||||||||||||||||||||||||||
| changeImg, | ||||||||||||||||||||||||||
| } from "./shared_variable.js"; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| form.addEventListener("submit", (e) => { | ||||||||||||||||||||||||||
| e.preventDefault(); | ||||||||||||||||||||||||||
| window.location.href = "/item"; | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
Comment on lines
+13
to
+16
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 크으 ~ 제출 이벤트 리스너를 추가하셨군요 ! 👍이벤트 객체를 활용한 제출에 이벤트 리스너를 추가하면 접근성은 물론이고 브라우저의 기본 사용자 경험인 엔터나 제출 버튼 클릭 모두 유효하겠어요 👍 |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // error messsage show | ||||||||||||||||||||||||||
| function showError(inputEle, errorEle, message) { | ||||||||||||||||||||||||||
| inputEle.style.border = "1px solid #f74747"; | ||||||||||||||||||||||||||
| errorEle.innerHTML = message; | ||||||||||||||||||||||||||
| errorEle.style.display = "block"; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // error message hide | ||||||||||||||||||||||||||
| function hideError(inputEle, errorEle) { | ||||||||||||||||||||||||||
| inputEle.style.border = "none"; | ||||||||||||||||||||||||||
| errorEle.style.display = "none"; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // 이메일 focusout | ||||||||||||||||||||||||||
| userEmail.addEventListener("focusout", () => { | ||||||||||||||||||||||||||
| if (userEmail.value === "") { | ||||||||||||||||||||||||||
| showError(userEmail, emailErrorMsg, errMsg.id.voidOut.trim()); | ||||||||||||||||||||||||||
| } else if (!emailCheck(userEmail.value)) { | ||||||||||||||||||||||||||
| showError(userEmail, emailErrorMsg, errMsg.id.fail.trim()); | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| hideError(userEmail, emailErrorMsg); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| activeButton(); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // 이메일 정규 표현식 체크 | ||||||||||||||||||||||||||
| function emailCheck(value) { | ||||||||||||||||||||||||||
| const emailRegex = | ||||||||||||||||||||||||||
| /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return emailRegex.test(value); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+44
to
+49
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 함수 이름은 동사로 짓는게 어떨까요?
Suggested change
일반적으로 변수는 명사, 함수는 동사로 지어요. 함수의 경우 다음과 같은 단어들이 접두사가 될 수 있어요:
Comment on lines
+44
to
+49
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 크으 ~ 순수 함수를 구현하시다니 👍해당 함수는 입력값(email)이 같으면 언제나 같은 결과(true/false)를 반환하고 외부 상태에 영향을 주거나 의존하지도 않아요. 이러한 구조는 테스트하기도 쉽고, 예측 가능한 코드 작성에 도움이 되는 좋은 패턴입니다. |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // 비밀번호 focusout | ||||||||||||||||||||||||||
| userPassword.addEventListener("focusout", () => { | ||||||||||||||||||||||||||
| if (userPassword.value.length === 0) { | ||||||||||||||||||||||||||
| showError(userPassword, pwErrorMsg, errMsg.pw.voidOut.trim()); | ||||||||||||||||||||||||||
| } else if (userPassword.value.length < 8) { | ||||||||||||||||||||||||||
| showError(userPassword, pwErrorMsg, errMsg.pw.fail.trim()); | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| hideError(userPassword, pwErrorMsg); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| activeButton(); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // 버튼 활성화 | ||||||||||||||||||||||||||
| function activeButton() { | ||||||||||||||||||||||||||
| if (emailCheck(userEmail.value) && userPassword.value.length >= 8) { | ||||||||||||||||||||||||||
| submitButton.disabled = false; | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| submitButton.disabled = true; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+64
to
+70
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 다음과 같이 작성해볼 수 있을 것 같아요 !
Suggested change
이렇게 하면 별칭(isValidEmail)으로 인해 가독성도 좋아지고, 조건 분기를 사용하지 않고 조건 자체를 값으로 대입해 볼 수 있어요 ! |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // 비밀번호 보기 | ||||||||||||||||||||||||||
| pwToggle.forEach((button) => { | ||||||||||||||||||||||||||
| button.addEventListener("click", (target) => { | ||||||||||||||||||||||||||
| const clickBtn = target.currentTarget; | ||||||||||||||||||||||||||
| const parentEle = clickBtn.closest(".flex_item"); | ||||||||||||||||||||||||||
| const targetInput = parentEle.querySelector(".input_field"); | ||||||||||||||||||||||||||
| const img = clickBtn.querySelector(".pw-icon"); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (targetInput.type === "password") { | ||||||||||||||||||||||||||
| targetInput.type = "text"; | ||||||||||||||||||||||||||
| img.src = changeImg.show; | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| targetInput.type = "password"; | ||||||||||||||||||||||||||
| img.src = changeImg.hide; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const form = document.querySelector(".form_contorl"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const userEmail = document.querySelector("#user_email"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const userPassword = document.querySelector("#user_password"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const submitButton = document.querySelector(".connection_button"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const emailErrorMsg = document.querySelector(".info_email .error_msg"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const pwErrorMsg = document.querySelector(".info_password .error_msg"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const pwToggle = document.querySelectorAll(".password_toggle"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const errMsg = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voidOut: "이메일을 입력해주세요.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail: "잘못된 이메일 형식입니다.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail: "닉네임을 입력해주세요.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pw: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voidOut: "비밀번호를 입력해주세요.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail: "비밀번호를 8자 이상 입력해주세요.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rePw: "비밀번호가 일치하지 않습니다.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+22
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (심화) 오오...... 에러 메시지를 구조적인 설계로 접근하셨네요 ..? 🫢좀 더 응용하면 스키마로 만들 수도 있겠는데요?
Suggested change
이렇게 확장해서 구성해볼 수도 있겠어요 ! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const changeImg = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hide: "./icon/ic_passwrod_hide.svg", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| show: "./icon/ic_passwrod_open.svg", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
(제안) 컬러 팔레트 변수명도 일관성있는 컨벤션으로 작성하는게 어떨까요 ? 😉