-
Notifications
You must be signed in to change notification settings - Fork 26
[심예진] sprint4 #75
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-\uC2EC\uC608\uC9C4-sprint4"
[심예진] sprint4 #75
Changes from all commits
983460c
ada2d15
37ffef9
84d78ba
f5534d4
03e0069
12cf5cf
879d476
3716104
73b1539
081c133
3ca7c4c
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 |
|---|---|---|
|
|
@@ -2,16 +2,30 @@ | |
| <html lang="ko"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <link rel="stylesheet" href="style.css"> | ||
| <link rel="stylesheet" href="global.css"> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:[email protected]&display=swap" rel="stylesheet"> | ||
| <title>판다마켓</title> | ||
| <!-- Open Graph (페북, 카카오, 디스코드)--> | ||
| <meta property="og:title" content="판다 마켓"> | ||
| <meta property="og:description" content="일상의 모든 것을 거래해보세요."> | ||
| <meta property="og:image" content="https://yejinshim.github.io/17-SPRINT-MISSION/image/meta/meta_FuBao.jpg"> | ||
| <meta property="og:url" content="https://yejinshim.github.io/17-SPRINT-MISSION"> | ||
| <meta property="og:type" content="website"> | ||
| <!-- Twitter Card --> | ||
| <meta name="twitter:card" content="summary_large_image" /> | ||
| <meta name="twitter:title" content="판다 마켓" /> | ||
| <meta name="twitter:description" content="일상의 모든 물건을 거래해보세요" /> | ||
| <meta name="twitter:image" content="https://yejinshim.github.io/17-SPRINT-MISSION/image/meta/meta_FuBao.jpg"> | ||
| </head> | ||
| <body> | ||
| <!-- <div class="allContent"> --> | ||
| <header> | ||
| <a href="/" class="logo-link"> | ||
| <img class="logo-container" src="image/Panda=lg.png" alt="판다마켓로고"> | ||
| <img class="logo-container" src="image/logo/pandaHome_logo.png" alt="판다마켓로고"> | ||
| </a> | ||
| <a href="/login" class="login-button">로그인</a> | ||
| </header> | ||
|
|
@@ -20,34 +34,36 @@ | |
| <h1 class="top_text">일상의 모든 물건을<br>거래해보세요</h1> | ||
| <a href="/items" class="looking-button">구경하러 가기</a> | ||
| </div> | ||
| <img class="hi" src="image/Img_home_top.png" alt="상단배경"> | ||
| <div class="ppanda"> | ||
| <img class="hi" src="/image/home/topPanda_home.png" alt="상단배경"> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="middle"> | ||
| <section class="box1"> | ||
| <section class="itembox"> | ||
| <div class="hot-item-pc"> | ||
| <img class="items" src="image/Img_home_01.png" alt="상품확인"> | ||
| <img class="items" src="/image/home/itemBox_home.png" alt="상품확인"> | ||
| </div> | ||
| <div class="hot-item-container"> | ||
| <span class="blue item"><b>Hot item</b></span> | ||
| <h1 class="content">인기 상품을<br>확인해 보세요</h1> | ||
| <p class="content2">가장 HOT한 중고거래 물품을<br>판다 마켓에서 확인해 보세요</p> | ||
| </div> | ||
| </section> | ||
| <section class="box2"> | ||
| <section class="searchbox"> | ||
| <div class="search-container"> | ||
| <span class="blue search"><b>Search</b></span> | ||
| <h1 class="content">구매를 원하는<br>상품을 검색하세요</h1> | ||
| <p class="content2">구매하고 싶은 물품은 검색해서<br>쉽게 찾아보세요</p> | ||
| </div> | ||
| <div class="search-pc"> | ||
| <img class="items" src="image/Img_home_02.png" alt="상품검색"> | ||
| <img class="items" src="/image/home/searchBox_home.png" alt="상품검색"> | ||
| </div> | ||
| </section> | ||
| <section class="box3"> | ||
| <section class="registerbox"> | ||
| <div class="register-pc"> | ||
| <img class="items" src="image/Img_home_03.png" alt="상품등록"> | ||
| <img class="items" src="/image/home/registerBox_home.png" alt="상품등록"> | ||
| </div> | ||
| <div class="register-container"> | ||
| <span class="blue register"><b>Resister</b></span> | ||
|
|
@@ -61,7 +77,9 @@ <h1 class="content">판매를 원하는<br>상품을 등록하세요</h1> | |
| <div class="bottom"> | ||
| <div class="bottom-center"> | ||
| <h1 class="bottom_text">믿을 수 있는<br>판다마켓 중고 거래</h1> | ||
| <img class="twopanda" src="image/Img_home_bottom.png" alt="하단배경"> | ||
| <div class="twoppanda"> | ||
| <img class="bye" src="/image/home/bottomPanda_home.png" alt="하단배경"> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
@@ -75,18 +93,19 @@ <h1 class="bottom_text">믿을 수 있는<br>판다마켓 중고 거래</h1> | |
| </div> | ||
| <div class="social"> | ||
| <a href="https://www.facebook.com" target="_blank"> | ||
| <img src="image/ic_facebook.png" alt="페이스북"> | ||
| <img src="image/icon/facebook_icon.png" alt="페이스북"> | ||
| </a> | ||
| <a href="https://x.com" target="_blank"> | ||
| <img src="image/ic_x.png" alt="트위터"> | ||
| <img src="image/icon/x_icon.png" alt="트위터"> | ||
| </a> | ||
| <a href="https://www.youtube.com" target="_blank"> | ||
| <img src="image/ic_youtube.png" alt="유튜브"> | ||
| <img src="image/icon/youtube_icon.png" alt="유튜브"> | ||
| </a> | ||
| <a href="https://www.instagram.com" target="_blank"> | ||
| <img src="image/ic_instagram.png" alt="인스타그램"> | ||
| <img src="image//icon/insta_icon.png" alt="인스타그램"> | ||
| </a> | ||
| </div> | ||
| </footer> | ||
| <!-- </div> --> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| const emailInput = document.getElementById("login-email"); | ||
| const passwordInput = document.getElementById("login-password"); | ||
| const emailError = document.getElementById("emailError"); | ||
| const passwordError = document.getElementById("passwordError"); | ||
| const togglePassword = document.getElementById("togglePassword"); | ||
| const loginBtn = document.getElementById("loginBtn"); | ||
|
|
||
| function validateEmail(email) { | ||
| const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; | ||
| return emailRegex.test(email); | ||
| } | ||
|
|
||
| function checkValidity() { | ||
|
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. 로직은 깔끔하게 잘 작성해주셨지만 해당 함수의 책임이 조금 많은 것 같습니다. 유효성 검사와 UI 상태 변경까지 이 함수에서 동시에 처리하고 있어서 함수 역할이 모호해진 것 같아요. 아래와 같은 방식로 '판단로직'과 '결과반영' 을 분리해주시면 가독성과 유지보수성이 좋아질 것 같습니다. |
||
| const emailValid = validateEmail(emailInput.value); | ||
| const passwordValid = passwordInput.value.length >= 8; | ||
| const errors = emailError.textContent || passwordError.textContent; | ||
|
|
||
| if (emailInput.value && passwordInput.value && emailValid && passwordValid && !errors) { | ||
| loginBtn.classList.remove("disabled"); | ||
| } else { | ||
| loginBtn.classList.add("disabled"); | ||
|
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. 현재는.disabled 클래스만 변경하고 있는데, 실제로 버튼 클릭을 막고 싶다면 button.disabled = true도 병행해주는 것이 좋습니다. |
||
| } | ||
| } | ||
|
|
||
| //이메일 확인 | ||
| emailInput.addEventListener("blur", () => { | ||
| const value = emailInput.value.trim(); | ||
| if (value === "") { | ||
| emailError.textContent = "이메일을 입력해주세요."; | ||
| emailInput.classList.add("input-error"); | ||
| } else if (!validateEmail(value)) { | ||
| emailError.textContent = "잘못된 이메일 형식입니다."; | ||
| emailInput.classList.add("input-error"); | ||
| } else { | ||
| emailError.textContent = ""; | ||
| emailInput.classList.remove("input-error"); | ||
| } | ||
| checkValidity(); | ||
| }); | ||
|
|
||
| //비밀번호 확인 | ||
| passwordInput.addEventListener("blur", () => { | ||
| const value = passwordInput.value.trim(); | ||
| if (value === "") { | ||
| passwordError.textContent = "비밀번호를 입력해주세요."; | ||
| passwordInput.classList.add("input-error"); | ||
| } else if (value.length < 8) { | ||
| passwordError.textContent = "비밀번호를 8자 이상 입력해주세요."; | ||
| passwordInput.classList.add("input-error"); | ||
| } else { | ||
| passwordError.textContent = ""; | ||
| passwordInput.classList.remove("input-error"); | ||
| } | ||
| checkValidity(); | ||
| }); | ||
|
|
||
| // //비밀번호 눈 가리기 | ||
|
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. 비밀번호 토글 로직을 아주 잘 작성해주셨습니다! 코드만 봤을땐 문제없이 동작할거같은데, 잘 안되었나요??🤔 |
||
| // togglePassword.addEventListener("click", () => { | ||
| // const eyePassword = passwordInput.getAttribute.type === "password"; | ||
|
|
||
| // passwordInput.type = eyePassword ? "text" : "password"; | ||
|
|
||
| // togglePassword.src = eyePassword | ||
| // ? "../image/icon/eyeopen_icon.png" | ||
| // : "../image/icon/eyeclosed_icon.png"; | ||
| // }) | ||
|
|
||
| loginBtn.addEventListener("click", (e) => { | ||
| e.preventDefault(); //a 태그의 기본 이동 막음 | ||
| const emailLogin = validateEmail(emailInput.value.trim()); | ||
| const passwordLogin = passwordInput.value.trim().length >= 8; | ||
| const errorLogin = emailError.textContent || passwordError.textContent; | ||
|
|
||
| if (emailInput.value && passwordInput.value && emailLogin && passwordLogin && !errorLogin) { | ||
| window.location.href = "/items"; | ||
| } | ||
| }); | ||
|
|
||
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.
역할별로 함수 분리를 잘 해주셨습니다! 👍
다만 에러 출력과 스타일 조작 로직이 매번 반복되고 있는데요, 아래와 같이 공용 함수로 분리하면 좋을 것 같습니다.