Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e204978
feat: login.css 파일명을 좀 더 포괄적인 auth.css로 변경
yuj2n Mar 20, 2025
f648040
불필요한 세팅 제거 및 이동
yuj2n Mar 20, 2025
c0d14f8
login페이지 에 불필요한 index.css 불러오기 삭제 및 login과 signup 페이지에 동일한 상단 여백 주기
yuj2n Mar 20, 2025
a5d5d55
feat: class 추가로 태그 선택자 삭제
yuj2n Mar 20, 2025
cb45e1d
Merge branch 'Basic-전유진' of https://github.com/codeit-bootcamp-fronte…
yuj2n Mar 20, 2025
03c32ed
style: 반응형에 따른 css 수정
yuj2n Mar 20, 2025
46d2b13
상단 바 css 조정
yuj2n Mar 21, 2025
c1768f7
css 일부 변경
yuj2n Mar 21, 2025
1b14f59
태블릿 사이즈 section css 수정 및 작성
yuj2n Mar 21, 2025
cdc780b
불필요한 코드 삭제 및 섹션 내용 좌우정렬
yuj2n Mar 21, 2025
d48d7ae
모바일 사이즈 섹션 css 작성
yuj2n Mar 21, 2025
1f2abae
모바일 사이즈 footer 작성
yuj2n Mar 22, 2025
6aab6c8
공유 디버거 이미지 추가
yuj2n Mar 22, 2025
f0205ba
375px 이하 화면 가리는 기능 추가
yuj2n Mar 22, 2025
274f54b
공유 디버거 사진 변경
yuj2n Mar 22, 2025
5ec8813
login과 signup 페이지 모바일 사이즈 반응형 구현 및 placeholder와 inactive 기능 추가
yuj2n Mar 22, 2025
2aed9d0
주석 추가
yuj2n Mar 22, 2025
be0919c
reset.css와 중복 내용 삭제
yuj2n Mar 22, 2025
1f1b2c2
불필요한 공백 삭제
yuj2n Mar 22, 2025
54c9e03
눈 아이콘 버튼 태그로 감싸기
yuj2n Mar 22, 2025
872b906
form에 적합하지 않은 내용 외부로 이동
yuj2n Mar 22, 2025
b4b040e
필요없는 주석 삭제
yuj2n Mar 22, 2025
585ed28
코드 최종 수정
yuj2n Mar 22, 2025
7c961e2
error 작동 및 css 작성
yuj2n Mar 23, 2025
372f9b9
에러 메시지 삭제 기능 추가
yuj2n Mar 23, 2025
f92c403
간편로그인 부분도 모바일 사이즈일 때 축소되는 기능
yuj2n Mar 23, 2025
3529153
login과 signup의 공통 내용을 위한 비밀번호 토글 기능 등의 코드 수정
yuj2n Mar 23, 2025
09107b6
로그인 성공 시 로드되는 페이지 작성
yuj2n Mar 23, 2025
c4805b2
에러 메시지와 폼 제출 이벤트를 위한 코드 작성
yuj2n Mar 23, 2025
282599c
auth.js와 중복된 변수 재선언을 통해 미작동 기능 수정
yuj2n Mar 23, 2025
268a9b9
로그인과 회원가입 버튼 공통 class 분리 및 동일 id 작성
yuj2n Mar 23, 2025
2d18283
login 버튼 class를 불러오므로 login -> .login으로 수정
yuj2n Mar 23, 2025
5486032
에러 메시지로 인한 회원가입 버튼 밀림으로 인한 요소 밀착 방지를 위한 margin 수정
yuj2n Mar 23, 2025
f4ff726
눈 모양 아이콘 활성화를 위한 id 추가
yuj2n Mar 23, 2025
e2b99e8
올바른 값 입력 시 border 색 추가
yuj2n Mar 23, 2025
fd087f4
회원가입 페이지 상단 여백 조정
yuj2n Mar 23, 2025
446ab3d
주석 내용 변경
yuj2n Mar 23, 2025
b77ef3b
이벤트리스너로 적용되는 기능 이미 존재하기 때문에 onclick기능 삭제
yuj2n Mar 23, 2025
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
69 changes: 69 additions & 0 deletions auth.js
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 칭찬
중복을 줄이신 점 좋아요!

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* login, signup 공통 */

// 이메일 유효성 검사 함수
function emailValidation(email) {
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return emailRegex.test(email);
}

// 요소 가져오기
const emailInput = document.getElementById("email");
const passwordInput = document.getElementById("password");
const emailErr = document.getElementById("emailErr");
const passwordErr = document.getElementById("passwordErr");
const passwordVisibility = document.getElementById("passwordVisibility");
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
passwordInput처럼 변수명을 통해 해당 변수가 어떤 타입의 값을 알 수 있도록 명명하시는 것이 가독성 측면에서 좋습니다~

Suggested change
const passwordVisibility = document.getElementById("passwordVisibility");
const passwordVisibilityButton = document.getElementById("passwordVisibility");


// 이메일 검증
function validateEmail() {
const emailValue = emailInput.value.trim();
if (emailValue === "") {
emailErr.textContent = "이메일을 입력해주세요.";
emailInput.classList.add("error-input");
emailInput.classList.remove("correct-input");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

올바른 값 입력 후 삭제 시 파란 테두리가 사라지지 않아 작성하였는데
이렇게 작성하는 것이 괜찮을까요? 아니면 에러 속성이 덮도록 작성하는 것이 좋을까요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

아마 error-input 클래스를 추가해도 해당 태그 클래스명에 correct-input이 있으면 correct-input이 우선 적용되신다는 말씀이신 것 같아요.
이를 해결하기 위해 css에서 error-input과 correct-input의 명시도를 보고 error-input의 명시도를 높이거나 후순위에 적어 correct-input이라는 클래스명이 태그에 존재해도 error-input이 있다면 무조건 적용되게 할 수 있으나, 그렇게되면 클래스명과 상태가 적절하지 않은 것 같아 지금 방식이 더 나은 것 같습니다.

다만 제가 알기로는 인풋의 border는 회색이 기본이고, 에러 발생 시 빨강, 포커스시 파랑으로 알고 있습니다.
이러한 요구사항을 구현하실때는 클래스를 두개로 나눠 작업하지 않으셔도 됩니다~

} else if (!emailValidation(emailValue)) {
emailErr.textContent = "잘못된 이메일 형식입니다.";
emailInput.classList.add("error-input");
emailInput.classList.remove("correct-input");
} else {
emailErr.textContent = "";
emailInput.classList.remove("error-input");
emailInput.classList.add("correct-input");
}
toggleButton();
}

// 비밀번호 검증
function validatePassword() {
const passwordValue = passwordInput.value.trim();
if (passwordValue === "") {
passwordErr.textContent = "비밀번호를 입력해주세요.";
passwordInput.classList.add("error-input");
passwordInput.classList.remove("correct-input");
} else if (passwordValue.length < 8) {
passwordErr.textContent = "비밀번호를 8자 이상 입력해주세요.";
passwordInput.classList.add("error-input");
passwordInput.classList.remove("correct-input");
} else {
passwordErr.textContent = "";
passwordInput.classList.remove("error-input");
passwordInput.classList.add("correct-input");
}
toggleButton();
}


// 비밀번호 보이기/숨기기 기능
function togglePasswordVisibility(input, button) {
if (input.type === "password") {
input.type = "text";
button.innerHTML = '<img src="/images/eye-icon.png" class="eye-icon" alt="eye-off">';
} else {
input.type = "password";
button.innerHTML = '<img src="/images/invisible-eye-icon.png" class="eye-icon" alt="eye-on">';
}
}

// 이벤트 리스너 추가
emailInput.addEventListener("focusout", validateEmail);
passwordInput.addEventListener("focusout", validatePassword);
passwordVisibility.addEventListener("click", () => togglePasswordVisibility(passwordInput, passwordVisibility));
216 changes: 216 additions & 0 deletions css/auth.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
.main-btn,
button {
cursor: pointer;
}

.main-btn:hover,
button:hover {
background: var(--blue200);
}

.main-btn:active,
button:active {
background: var(--blue300);
}

.main-btn:disabled,
button:disabled {
background: var(--inactive);
}

main {
height: 61.8rem;
margin: 22rem auto;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 1rem;
}

.logo-box {
width: 39.6rem;
height: 13.2rem;
display: flex;
justify-content: center;
align-items: center;
gap: 2rem;
}

.logo {
width: 10rem;
height: 10rem;
}

.pandamarket {
width: 26.6rem;
height: 12rem;
color: var(--blue100);
}

form {
margin-top: 4rem;
width: 64rem;
height: 44.6em;
display: flex;
flex-direction: column;
gap: 1rem;
}

.signup-form {
margin-bottom: 20rem;
}

.login-input {
margin-bottom: 2rem;
display: flex;
flex-direction: column;
gap: 1rem;
}

.password-container {
position: relative;
}

.password-container input {
width: 100%; /* input이 가득 차도록 */
padding-right: 4rem; /* 아이콘과 텍스트 간 간격 확보 */
box-sizing: border-box; /* 패딩이 width에 포함되도록 설정 */
}

.eye-icon {
position: absolute;
right: 1.5rem;
top: 42%;
transform: translateY(-50%);
cursor: pointer;
width: 24px;
height: 24px;
}
Comment on lines +81 to +89
Copy link
Collaborator Author

@yuj2n yuj2n Mar 23, 2025

Choose a reason for hiding this comment

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

에러 메시지가 추가 시 눈 모양 아이콘이 해당 너비의 비율을 맞추기 위해 아래로 일정 크기만큼 내려가는데
내려가지 않게 하려면

  1. querySelector로 js에서 아이콘에 위치를 수정해주는 class나 id를 추가해주는 방식으로 해결하는 것이 좋을까요?
  2. 아니면 애초에 내려가는 것을 방지하도록 css적으로 어떻게 해결할 수 있는지 궁금합니다!

Copy link
Collaborator

@GANGYIKIM GANGYIKIM Mar 28, 2025

Choose a reason for hiding this comment

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

질문에 남겨주셔서 코드리뷰에서 답변 드렸으니 참고해주세요!
참고로 css 적으로 수정하시려면 반응형 수치가 아닌 top: 20px 같은 식으로 고정값을 입력해주시면 됩니다!


label {
margin-bottom: 1rem;
font-size: 1.8rem;
font-weight: 700;
}

input {
font-size: 1.6rem;
height: 5.6rem;
padding: 2rem;
border-radius: 1.2rem;
background-color: var(--gray100);
}

input::placeholder {
color: var(--inactive);
}

.error-input {
border: 2px solid var(--red);
}

.correct-input {
border: 2px solid var(--blue100);
}

.errMsg {
display: block;
margin-left: 2rem;
color: var(--red);
font-size: 1.4rem;
font-weight: 600;
}

#btn {
height: 5.6rem;
color: var(--gray100);
font-size: 2rem;
font-weight: 600;
padding: 1.6rem 12.4rem;
border-radius: 4rem;
background-color: var(--inactive);
}

.easy-login {
width: 64rem;
margin: 4rem 0;
background-color: #e6f2ff;
border-radius: 0.8rem;
}

.easy-login-box {
height: 5rem;
margin: 1.6rem 2.3rem;
display: flex;
justify-content: space-between;
align-items: center;
}

.easy-login-box p {
font-size: 1.6rem;
font-weight: 500;
}

.easy-login-icons {
display: flex;
gap: 1.6rem;
}

.question {
margin-top: 1rem;
display: flex;
justify-content: center;
font-size: 1.4rem;
font-weight: 500;
}

.question a {
text-decoration: underline;
color: var(--blue100);
}

.signup,
.login {
font-size: 1.4rem;
font-weight: 500;
}

/* Mobile: 767px 이하 */
@media (max-width: 767px) {
main {
margin: 15rem auto;
width: 100%;
max-width: 40rem; /* 최대 너비 400px */
padding: 0 1.6rem; /* 좌우 여백 16px */
}
.logo-box {
width: 100%;
max-width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
form {
margin-top: 0;
width: 100%; /* 부모(main)의 너비를 따름 */
}
.logo {
width: 5.2rem;
height: auto;
}
.pandamarket {
width: 13.3rem; /* 텍스트 로고 크기 조절 */
height: auto;
}
label {
font-size: 1.4rem;
}
.easy-login {
width: 100%;
margin: 1.6rem 0;
}
.question {
width: 100%;
}
}
2 changes: 2 additions & 0 deletions css/base.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import url(./unsupported.css);

:root {
/* Primary color */
--blue100: #3692FF;
Expand Down
Loading
Loading