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
78 changes: 45 additions & 33 deletions common/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ header,
align-items: flex-end;
width: 100%;
height: 540px;
background-color: #CFE5FF;
background-color: #cfe5ff;
margin: 0 auto;
}

Expand All @@ -34,14 +34,14 @@ main {
margin-bottom: 120px;
}


footer {
width: 100%;
background-color: #111827;
padding: 32px 0 108px;
padding: 32px 0 108px;
}

.login-btn {
.login-btn,
.signup-btn {
display: inline-flex;
padding: 12px 23px;
background-color: var(--blue);
Expand All @@ -56,42 +56,59 @@ footer {
text-decoration: none;
}



.header-btn {
display: inline-flex;
width: 357px;
height: 56px;
height: 56px;
background-color: var(--blue);
border-radius: 40px;
border-style: none;
border-style: none;
text-decoration: none;
Comment on lines +65 to 66
Copy link
Collaborator

Choose a reason for hiding this comment

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

불필요한 속성은 최대한 줄여주시는 게 좋아요! 🙂

현재 클래스네임에는 해당 속성이 필요하지 않아요. 사용한 태그에는 보더 스타일이 적용되어 있지 않고, text-decoration: none;은 이미 common.css 파일에 적용되어 있어요.

color: var(--white);
font-size: 20px;
font-weight: 600;
font-weight: 600;
justify-content: center;
align-items: center;
min-width: 240px;
min-height: 48px;
Comment on lines 72 to 73
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분도 이미 뷰포트에 맞게 고정 너비와 높이가 있어서, 제거해도 될 것 같아요. 일반적으로 버튼 UI는 padding 속성으로 크기를 조절하는 것이 좋다고 생각해요.

범용적인 버튼 스타일일 경우에 패딩으로 조절하면 콘텐츠에 맞게 크기가 달라지고, 반응형에 좀 더 유연하다는 장점이 있습니다. 현재는 고정 너비로 잘 처리해 주셨지만, 예기치 못한 상황에서 레이아웃이 깨질 수도 있어요.

}
}

.title:hover ,.logo:hover{
.eye {
position: absolute;
width: 24px;
height: 24px;
right: 16px;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
}
Comment on lines +76 to 84
Copy link
Collaborator

Choose a reason for hiding this comment

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

스크린샷 2025-08-04 오후 3 42 45

요구사항에 맞게 스타일링을 잘해주셨어요. 여기서 비밀번호가 눈 모양 아이콘과 겹치지 않게 만들어주면 더 좋을 것 같네요! 각자의 영역을 갖도록 하거나, 인풋 태그에 패딩을 줘도 될 것 같아요. 다른 사이트에서 개발자 도구를 켜서, 어떻게 처리를 했는지도 확인해 보세요. 👍 참고하실만한 페이지의 링크를 첨부해 드릴게요.


.login-btn:hover , .header-btn:hover {
.title:hover,
.logo:hover {
cursor: pointer;
background-color: #1967D6;
}

.login-btn:focus, .header-btn:focus {
background-color: #1251AA;
.login-btn:hover,
.header-btn:hover,
.signup-btn:hover {
cursor: pointer;
background-color: #1967d6;
}

.login-btn:disabled, .header-btn:disabled {
background-color: var(--gray400);
.login-btn:focus,
.header-btn:focus,
.signup-btn:focus {
background-color: #1251aa;
}

.login-btn:disabled,
.header-btn:disabled,
.signup-btn:disabled {
background-color: var(--gray400);
color: var(--white);
cursor: not-allowed;
pointer-events: none;
Comment on lines +109 to +110
Copy link
Collaborator

Choose a reason for hiding this comment

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

pointer-events: none; 선언은 포인터 이벤트 자체를 없애는 거라서 커서 이벤트가 적용되지 않아요. 둘 중에 하나를 선택해서 적용해 주세요. 🙂

}
Comment on lines +91 to +111
Copy link
Collaborator

Choose a reason for hiding this comment

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

하나의 클래스로 공통 속성을 적용해 보는 것은 어떨까요?

.primary-btn:hover {
  cursor: pointer;
  background-color: #1967d6;
}

이렇게 만들고, 해당 버튼만의 스타일과 공통 버튼 스타일을 적용해 보면 좋을 것 같아요.

<!-- 로그인 버튼 예시 -->
<button class="login-btn primary-btn" type="submit" disabled>
  로그인
</button>


@media (min-width: 768px) and (max-width: 1199px) {
nav {
Expand All @@ -107,20 +124,17 @@ footer {
}

main {
margin: 52px 0 82px;
margin: 52px 0 82px;
display: flex;
flex-direction: column;
padding: 0 20px;
}
padding: 0 20px;
}


footer {
footer {
width: 100%;
height: 160px;
padding: 32px 104px 108px 104px;
padding: 32px 104px 108px 104px;
}


}

@media (max-width: 767px) {
Expand All @@ -132,22 +146,20 @@ footer {
padding: var(--login-btn-padding);
}


header {
height: 540px;
height: 540px;
}

main {
margin: 52px 0 82px;
margin: 52px 0 82px;
display: flex;
flex-direction: column;
padding: 0 20px;
padding: 0 20px;
}
footer {

footer {
width: 100%;
height: 160px;
padding: 32px 32px 30px 32px;
padding: 32px 32px 30px 32px;
}

}
35 changes: 17 additions & 18 deletions common/variables.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
:root {
--gray900: #11827;
--gray800: #1F2937;
--gray800: #1f2937;
--gray700: #374151;
--gray600: #4B5563;
--gray500: #6B7280;
--gray400: #9CA3AF;
--gray200: #E5E7EB;
--gray100: #F3F4F6;
--blue :#3692FF;
--white: #FFFFFF;
--gray600: #4b5563;
--gray500: #6b7280;
--gray400: #9ca3af;
--gray200: #e5e7eb;
--gray100: #f3f4f6;
--blue: #3692ff;
--red: #f74747;
--white: #ffffff;

--font-size-14 : 0.875rem;
--font-size-16 : 1rem;
--font-size-18 : 1.125rem;
--font-size-20 : 1.25rem;
--font-size-24 : 1.5rem;
--font-size-32 : 2rem;
--font-size-40 : 2.5rem;
--font-size-14: 0.875rem;
--font-size-16: 1rem;
--font-size-18: 1.125rem;
--font-size-20: 1.25rem;
--font-size-24: 1.5rem;
--font-size-32: 2rem;
--font-size-40: 2.5rem;

--clamp-24: clamp(1rem, 2.5vw, 1.5rem);
--clamp-40: clamp(1.8rem, 3.5vw, 2.5rem);



--nav-title: 25.63px;
--login-btn-padding: 11px 43px;
--login-btn-padding: 11px 43px;
}
112 changes: 69 additions & 43 deletions login/index.html
Original file line number Diff line number Diff line change
@@ -1,50 +1,76 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link rel="shortcut icon" href="/images/pandaicon.png" type="image/x-icon">
<link rel="stylesheet" href="/common/reset.css">
<link rel="stylesheet" href="/common/variables.css">
<link rel="stylesheet" href="/common/common.css" >
<link rel="stylesheet" href="/login/style.css" >
</head>
<body>
<div class="content">
<div class="title">
<img class="logo" src="/images/pandaicon.png" alt="판다마켓로고">
<a href="/"><h1>판다마켓</h1></a>
</div>
<form>
<div class="email">
<label for="email">이메일</label>
<input class="email-input" name="email" type="email" placeholder="이메일을 입력해 주세요.">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login</title>
<link
rel="shortcut icon"
href="/images/pandaicon.png"
type="image/x-icon"
/>
<link rel="stylesheet" href="/common/reset.css" />
<link rel="stylesheet" href="/common/variables.css" />
<link rel="stylesheet" href="/common/common.css" />
<link rel="stylesheet" href="/login/style.css" />
</head>
<body>
<div class="content">
<div class="title">
<img class="logo" src="/images/pandaicon.png" alt="판다마켓로고" />
<a href="/"><h1>판다마켓</h1></a>
</div>
Comment on lines +18 to 22
Copy link
Collaborator

Choose a reason for hiding this comment

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

스크린샷 2025-08-04 오후 5 03 42

메인 페이지 헤더의 로고처럼, 로그인/회원가입 페이지의 판다마켓 아이콘도 함께 링크 영역으로 만들어서 동작의 일관성을 갖게하는 건 어떨까요?

스크린샷 2025-08-04 오후 4 56 00

또한, 로고의 "판다마켓" 텍스트만 글꼴이 달라요. 로고만을 위해 글꼴을 다운받기 보다는, 로고(텍스트 + 아이콘) 자체를 다운받아서 사용하시는 것을 추천드려요! 또한, 이렇게 로고의 크기를 다양하게 사용해야 할 때는 이미지의 크기와 상관없이 이미지가 선명한 svg 포맷을 사용하시면 좋아요. 🙂

<div class="pwd">
<label for="password">비밀번호</label>
<div class="pwd-content">
<input class="pwd-input" name="password" type="password" placeholder="비밀번호를 입력해 주세요." >
<img class="eye" src="/images/btn_visibility_off.png">
<form id="LoginForm">
<div class="email">
<label for="email">이메일</label>
<input
id="email"
class="email-input"
name="email"
type="email"
placeholder="이메일을 입력해 주세요."
/>
<div id="email-error" class="error-message"></div>
</div>
<div class="pwd">
<label for="password">비밀번호</label>
<div class="pwd-content">
<input
id="password"
class="pwd-input"
name="password"
type="password"
placeholder="비밀번호를 입력해 주세요."
/>
<img
class="eye"
id="eyeIcon"
src="/images/btn_visibility_off.png"
/>
</div>
<div id="password-error" class="error-message"></div>
</div>
<button class="login-btn" type="submit" disabled>로그인</button>
</form>
<div class="section">
<div class="simple-login">
<h3>간편 로그인 하기</h3>
</div>
<div class="sns">
<a href="https://www.google.com/"
><img src="/images/google.png" alt="google"
/></a>
<a href="https://www.kakaocorp.com/page/"
><img src="/images/kakao.png" alt="kakao"
/></a>
</div>
</div>
<button class="login-btn" type="submit">로그인</button>
</form>
<div class="section">
<div class="simple-login">
<h3>간편 로그인 하기</h3>
</div>
<div class="sns">
<a href="https://www.google.com/"><img src="/images/google.png" alt="google"></a>
<a href="https://www.kakaocorp.com/page/"><img src="/images/kakao.png" alt="kakao"></a>
</div>
</div>
<div class="sign-up-message">
<div class="message">
판다 마켓이 처음이신가요? <a href="/signup/">회원가입</a>
<div class="sign-up-message">
<div class="message">
판다 마켓이 처음이신가요? <a href="/signup/">회원가입</a>
</div>
</div>
</div>

</div>
</body>
</html>
<script type="module" src="/login/index.js"></script>
</body>
</html>
71 changes: 71 additions & 0 deletions login/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import {
preventPasswordSpaces,
updateButtonState,
validateEmailInput,
validatePasswordInput,
togglePasswordVisiblity,
} from "../shared/form-utils.js";

const emailInput = document.getElementById("email");
const emailError = document.getElementById("email-error");

const passwordInput = document.getElementById("password");
const passwordError = document.getElementById("password-error");

const loginBtn = document.querySelector(".login-btn");
const loginForm = document.getElementById("LoginForm");
const eyeIcon = document.getElementById("eyeIcon");

function validateEmail() {
return validateEmailInput(emailInput, emailError);
}

function validatePassword() {
return validatePasswordInput(passwordInput, passwordError);
}

function eyeIconClickHandler() {
togglePasswordVisiblity(passwordInput, eyeIcon);
}

function updateLoginBtnState() {
return updateButtonState({
inputs: [emailInput, passwordInput],
errors: [emailError, passwordError],
button: loginBtn,
});
}

emailInput.addEventListener("blur", () => {
validateEmail();
updateLoginBtnState();
});

passwordInput.addEventListener("blur", () => {
validatePassword();
updateLoginBtnState();
});

emailInput.addEventListener("input", () => {
validateEmail();
updateLoginBtnState();
});

passwordInput.addEventListener("input", () => {
validatePassword();
updateLoginBtnState();
});

eyeIcon.addEventListener("click", () => {
eyeIconClickHandler();
});
Comment on lines +59 to +61
Copy link
Collaborator

Choose a reason for hiding this comment

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

eyeIconClickHandler라는 함수로 한 번 감싸주었기 때문에, 아래처럼 바로 핸들러를 넘겨줘도 됩니다!

Suggested change
eyeIcon.addEventListener("click", () => {
eyeIconClickHandler();
});
eyeIcon.addEventListener('click', eyeIconClickHandler);

또는, 래핑 함수를 따로 만들지 않고, 리스너의 콜백에서 처리하는 방법도 있겠네요.

Suggested change
eyeIcon.addEventListener("click", () => {
eyeIconClickHandler();
});
eyeIcon.addEventListener('click', () => {
togglePasswordVisiblity(passwordInput, eyeIcon);
});


loginForm.addEventListener("submit", (e) => {
e.preventDefault();
if (!loginBtn.disabled) {
window.location.href = "/items";
}
});

preventPasswordSpaces(passwordInput);
updateLoginBtnState(); // 초기 상태 업데이트
Copy link
Collaborator

Choose a reason for hiding this comment

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

이미 index.html에서 버튼에 disabled 속성을 줬기 때문에 초기 상태는 비활성화된 상태예요. 해당 코드는 지워도 됩니다!

Loading
Loading