Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions global.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,29 @@ html, body {
width: 100%;
height: 100%;
font-family: 'Noto Sans KR', sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

a {
text-decoration: none;
color: #3692FF;
}

form {
/* form {
display: flex;
flex-direction: column;
justify-content: space-around;
gap: 16px;
width: 100%;
} */

/* PC: 1200px 이상 */
@media (min-width: 1200px) {
}

/* Tablet: 768px 이상 ~ 1199px 이하 */
@media (min-width: 768px) and (max-width: 1199px) {
}

/* Mobile: 375px 이상 ~ 767px 이하 */
@media (min-width: 375px) and (max-width: 767px) {
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed image/login-top.png
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file added image/meta/meta_FuBao.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed image/show.png
Binary file not shown.
45 changes: 32 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>

Expand All @@ -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>
64 changes: 61 additions & 3 deletions login/login.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 700px;
height: auto;
margin-top: 140px;
margin-bottom: 140px;
}

form {
display: flex;
flex-direction: column;
justify-content: space-around;
gap: 16px;
width: 100%;
}

@media (max-width: 767px) {
.container {
padding: 0 16px;
width: 100%;
max-width: 700px;
}
}

.pandalogo {
width: 266px;
height: 90px;
Expand All @@ -9,6 +43,7 @@
display: flex;
flex-direction: column;
gap: 10px;
width: 100%;
}

label {
Expand All @@ -17,14 +52,28 @@ label {
}

input {
width: 640px;
width: 100%;
/* width: 640px; */
height: 56px;
background-color: #F3F4F6;
border: 1px solid #F3F4F6;
border-radius: 12px;
padding-left: 24px;
}

#emailError,
#passwordError {
color: #F74747;
/* border-color: #F74747; 이건 텍스트 태그엔 적용 안되므로 따로 설정 필요.. */
font-size: 14px;
padding-left: 8px;
}

.input-error {
border: 1px solid #F74747;
background-color: #F3F4F6;
}

.input-wrapper {
position: relative;
}
Expand All @@ -42,7 +91,8 @@ input {
display: flex;
justify-content: center;
align-items: center;
width: 640px;
width: 100%;
/* width: 640px; */
height: 56px;
background-color: #3692FF;
margin-top: 24px;
Expand All @@ -52,10 +102,18 @@ input {
text-decoration: none;
}

.login-button.disabled {
background-color: #D1D5DB;
color: white;
pointer-events: none; /* 클릭 비활성화 */
opacity: 0.6;
}

.simple-login {
display: flex;
flex-direction: column;
width: 640px;
width: 100%;;
/* width: 640px; */
height: 74px;
background-color: #E6F2FF;
margin: 24px;
Expand Down
18 changes: 13 additions & 5 deletions login/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,44 @@
<title>로그인</title>
</head>
<body>
<div class="container">
<header>
<img class="pandalogo" src="login-image/pandalogo.png" alt="판다마켓로고">
<img class="pandalogo" src="/image/logo/pandaLogin_logo.png" alt="판다마켓로고">
</header>
<form>
<div class="email-container">
<label for="login-email">이메일<br></label>
<input id="login-email" name="email" type="email" placeholder="이메일을 입력하세요.">
<p id="emailError" class="error-message"></p>
</div>
<div class="password-container">
<label for="login-password">비밀번호<br></label>
<div class="input-wrapper">
<input id="login-password" name="password" type="password" placeholder="비밀번호를 입력하세요.">
<img src="/login/login-image/eyeclosed.png" alt="비밀번호 보기" class="eyeclosed-icon">
<img id="togglePassword"
src="/image/icon/eyeclosed_icon.png"
alt="비밀번호 보기"
class="eyeclosed-icon">
</div>
<p id="passwordError" class="error-message"></p>
</div>
</form>
<a href="/login" class="login-button">로그인</a>
<a href="/login" id="loginBtn" class="login-button disabled">로그인</a>
<div class="simple-login">
<p class="simple-text">간편 로그인하기</p>
<div class="social-container">
<a href="https://www.google.com/" target="_blank" class="social-icon">
<img src="/login/login-image/google.png" target="_blank">
<img src="/image/icon/google_icon.png" target="_blank">
</a>
<a href="https://www.kakaocorp.com/page/" target="_blank">
<img src="/login/login-image/kakaotalk.png" target="_blank" class="social-icon">
<img src="/image/icon/kakaotalk_icon.png" target="_blank" class="social-icon">
</a>
</div>
</div>
<footer>
<p>판다마켓이 처음이신가요? <a href="/signup">회원가입</a></p>
</footer>
</div>
<script src="login.js"></script>
</body>
</html>
78 changes: 78 additions & 0 deletions login/login.js
Copy link
Collaborator

Choose a reason for hiding this comment

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

역할별로 함수 분리를 잘 해주셨습니다! 👍
다만 에러 출력과 스타일 조작 로직이 매번 반복되고 있는데요, 아래와 같이 공용 함수로 분리하면 좋을 것 같습니다.

function setError(inputEl, errorEl, message) {
 errorEl.textContent = message;
 inputEl.classList.add("input-error");
}

function clearError(inputEl, errorEl) {
 errorEl.textContent = "";
 inputEl.classList.remove("input-error");
}

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() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

로직은 깔끔하게 잘 작성해주셨지만 해당 함수의 책임이 조금 많은 것 같습니다.

유효성 검사와 UI 상태 변경까지 이 함수에서 동시에 처리하고 있어서 함수 역할이 모호해진 것 같아요.

아래와 같은 방식로 '판단로직'과 '결과반영' 을 분리해주시면 가독성과 유지보수성이 좋아질 것 같습니다.


function isFormValid() {
  const emailValid = validateEmail(emailInput.value);
  const passwordValid = passwordInput.value.length >= 8;
  const noErrors = !emailError.textContent && !passwordError.textContent;

  return emailInput.value && passwordInput.value && emailValid && passwordValid && noErrors;
}

function updateButtonState() {
  if (isFormValid()) {
    loginBtn.classList.remove("disabled");
    loginBtn.disabled = false;
  } else {
    loginBtn.classList.add("disabled");
    loginBtn.disabled = true;
  }
}

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");
Copy link
Collaborator

Choose a reason for hiding this comment

The 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();
});

// //비밀번호 눈 가리기
Copy link
Collaborator

Choose a reason for hiding this comment

The 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";
}
});

Binary file removed signup/signup-image/eyeclosed.png
Binary file not shown.
Binary file removed signup/signup-image/google.png
Binary file not shown.
Binary file removed signup/signup-image/kakaotalk.png
Binary file not shown.
Binary file removed signup/signup-image/pandalogo.png
Binary file not shown.
Loading
Loading