Skip to content

Conversation

@HarrySeop
Copy link
Collaborator

🐼 판다마켓 - 미션4

🌐 미션 배포 주소: https://harryseop-pandamarket.netlify.app/

기본 요구사항

  • Github에 PR(Pull Request)을 만들어서 미션을 제출합니다.
  • 피그마 디자인에 맞게 페이지를 만들어 주세요.
  • React와 같은 UI 라이브러리를 사용하지 않고 진행합니다.

체크리스트 [기본]

로그인

  • 이메일 input에서 focus out 할 때, 값이 없을 경우 input에 빨강색 테두리와 아래에 "이메일을 입력해주세요." 빨강색 에러 메세지를 보입니다.
  • 이메일 input에서 focus out 할 때, 이메일 형식에 맞지 않는 경우 input에 빨강색 테두리와 아래에 "잘못된 이메일 형식입니다" 빨강색 에러 메세지를 보입니다.
  • 비밀번호 input에서 focus out 할 때, 값이 없을 경우 아래에 "비밀번호를 입력해주세요." 에러 메세지를 보입니다
  • 비밀번호 input에서 focus out 할 때, 값이 8자 미만일 경우 아래에 "비밀번호를 8자 이상 입력해주세요." 에러 메세지를 보입니다.
  • input 에 빈 값이 있거나 에러 메세지가 있으면 '로그인' 버튼은 비활성화 됩니다.
  • input 에 유효한 값을 입력하면 '로그인' 버튼이 활성화 됩니다.
  • 활성화된 '로그인' 버튼을 누르면 "/items" 로 이동합니다

회원가입

  • 이메일 input에서 focus out 할 때, 값이 없을 경우 input에 빨강색 테두리와 아래에 "이메일을 입력해주세요." 빨강색 에러 메세지를 보입니다.
  • 이메일 input에서 focus out 할 때, 이메일 형식에 맞지 않는 경우 input에 빨강색 테두리와 아래에 "잘못된 이메일 형식입니다" 빨강색 에러 메세지를 보입니다.
  • 닉네임 input에서 focus out 할 때, 값이 없을 경우 input에 빨강색 테두리와 아래에 "닉네임을 입력해주세요." 빨강색 에러 메세지를 보입니다.
  • 비밀번호 input에서 focus out 할 때, 값이 없을 경우 아래에 "비밀번호를 입력해주세요." 에러 메세지를 보입니다
  • 비밀번호 input에서 focus out 할 때, 값이 8자 미만일 경우 아래에 "비밀번호를 8자 이상 입력해주세요." 에러 메세지를 보입니다.
  • 비밀번호 input과 비밀번호 확인 input의 값이 다른 경우, 비밀번호 확인 input 아래에 "비밀번호가 일치하지 않습니다.." 에러 메세지를 보입니다.
  • input 에 빈 값이 있거나 에러 메세지가 있으면 '회원가입' 버튼은 비활성화 됩니다.
  • input 에 유효한 값을 입력하면 '회원가입' 버튼이 활성화 됩니다.
  • 활성화된 '회원가입' 버튼을 누르면 로그인 페이지로 이동합니다

체크리스트 [심화]

  • 눈 모양 아이콘 클릭시 비밀번호의 문자열이 보이기도 하고, 가려지기도 합니다.
  • 비밀번호의 문자열이 가려질 때는 눈 모양 아이콘에는 사선이 그어져있고, 비밀번호의 문자열이 보일 때는 사선이 없는 눈 모양 아이콘이 보이도록 합니다.

변경 사항 [코드 리뷰]

미션1 ➡️ 미션2

  • 사용하지 않는 이미지 파일 제거
  • css 변수 선언 재사용으로 적용하기
  • !important 키워드 제거
  • 빈 html 연결 제거
  • 컨벤션 통일을 위한 파일이름 변경

미션2 ➡️ 미션3

  • 불안정하게 구현한 유틸리티 스타일 시트 제거
  • 폰트 적용을 위한 reset.css 템플릿코드 도입
  • css 구조 변경 후 분리 (불필요한 css파일 호출 방지)
  • 중복되는 스타일 시트를 줄이기 위해 공통 css파일로 분리
  • 비밀번호 토글 아이콘 버튼으로 변경
  • 아이콘 로고 리스트 시멘틱태그 변경

미션3 ➡️ 미션4

미션3 코드리뷰 전에 미션4를 진행해서 코드리뷰로 인한 변경 X

주강사 님에게

  • script 파일들은 scripts 폴더 내에서 분리해서 구현했습니다. 파일 구조도 괜찮은지 확인 부탁드려요.
  • formErrorcreateValidator에서 import를 해서 사용하는 구조로 구현했습니다. 최대한 의존도를 줄이고 싶었지만 그러면 분리를 하기 어려울 것 같아 지금처럼 구현했습니다. 잘못된 부분이 있으면 확인 부탁드려요.
  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

- reset.css를 추가해서 구현
- 기존의 reset.css에서 구현한 코드를 base.css에서 관리
- home_adaptive.css 파일은 반응형으로 변경 전 코드를 이전(구현 후 제거 예정)
- login.css, signup.css를 통합 구현하기 전 임시적으로 auth.css에서 관리
- 웹 접근성을 위해 시맨틱 태그를 변경하였습니다.
- 편의를 위해 1rem = 10px로 변경했습니다.
- 사소한 값은 자체 보정 했습니다.
- 비밀번호 보이게하는 버튼용 아이콘 에셋을 추가했습니다.
@HarrySeop HarrySeop added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Mar 22, 2025
@GANGYIKIM GANGYIKIM closed this Mar 25, 2025
@GANGYIKIM GANGYIKIM reopened this Mar 25, 2025
Copy link
Collaborator

@GANGYIKIM GANGYIKIM left a comment

Choose a reason for hiding this comment

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

지섭님 4번째 미션 제출 고생하셨습니다.
구현도 잘 하시고 정리도 잘하셔서 가독성이 좋은 코드였어요.
이제 React로 넘어가시는데 더 즐겁게 작업하실 것 같아요!
다음 미션도 화이팅입니다.


  • 회원가입 페이지도 요구사항을 구현하셨다고 체크해주셨는데, 코드상에는 보이지 않네요! 확인해보시면 좋겠어요.

  • 비밀번호 토글도 동작하지 않고, 코드상에서도 찾을 수가 없습니다.

  • script 파일들은 scripts 폴더 내에서 분리해서 구현했습니다. 파일 구조도 괜찮은지 확인 부탁드려요.:
    지금 파일이 다 올라오지 않아서 의도를 파악하기 어려울 것 같습니만 지금 구조 기반으로 코멘트 드리겠습니다. 개인적으로 무난해보입니다만 login_validation.js, validation, validation/validation.js 등 중복되는 단어가 많이 들어가는 것 같습니다. 개인적으로 validation/validation.js 경우 폴더명과 파일명이 완전히 일치하니 다름 이름으로 변경하시는 것을 추천드리고, login_validation의 경우 login.js 정도면 충분하지 않을까합니다.

  • formError를 createValidator에서 import를 해서 사용하는 구조로 구현했습니다. 최대한 의존도를 줄이고 싶었지만 그러면 분리를 하기 어려울 것 같아 지금처럼 구현했습니다. 잘못된 부분이 있으면 확인 부탁드려요.:
    지금 코드상에서는 어떤 부분을 말씀하시는 지 확인하기 어려워 답변드리지 못할 것 같습니다.

email_validate_regex: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
password_min_length: 8,
empty_message: '',
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
SYMBOL이라는 객체명은 너무 많은 것을 의미해서 해당 값들의 의미를 잘 전달하지 못하는 것 같습니다.
해당 객체는 이메일 유효성 검사 정규식, 비밀번호 최소 길이 등을 포함하고 있으므로 이를 알 수 있는 이름으로 변경하시는 것을 추천드려요!

</div>
</div>

<script type="module" src="./scripts/login_validation.js"></script>
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
script 태그는 상단에 있는게 구조 파악측면에서 유리하다고 생각해서 큰 이유가 없다면 상단 head 태그에 두시는 것을 추천드려요~
특히 타입이 모듈인 스크립트는 defer 속성을 자동으로 가지기 때문에 따로 하단에 배치하실 이유가 없습니다~

Comment on lines +1 to +4
export const EMAIL_VALIDATION = Object.freeze({
invalid_email: '잘못된 이메일 형식입니다.',
required_email: '이메일을 입력해주세요.',
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
EMAIL_VALIDATION 이름보다 EMAIL_ERROR_MESSAGE와 같이 에러문구 객체라는 것을 알 수 있는 이름이 더 좋을 것 같아요~

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 칭찬
확인할 수는 없지만 회원가입과 로그인에서 공용 로직을 같이 사용하기 위해 따로 빼주신 것 같아요!
중복을 줄이시고 주석도 자세히 달아두신 것 좋습니다.

Comment on lines +67 to +72
const emailError = validateEmail(emailInput.value.trim());
const passwordError = validatePassword(passwordInput.value.trim());

if (!emailError && !passwordError) {
window.location.href = '/items.html';
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
폼의 값들이 유효하지 않으면 disabled 속성으로 인해 해당 이벤트가 발생하지 않으므로 여기서 유효성 검사를 할 필요가 없어보여요.

Suggested change
const emailError = validateEmail(emailInput.value.trim());
const passwordError = validatePassword(passwordInput.value.trim());
if (!emailError && !passwordError) {
window.location.href = '/items.html';
}
window.location.href = '/items.html';

Comment on lines +6 to +7
const loginButton = document.querySelector('.auth__button');
const loginForm = document.querySelector('form');
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 여담
제 생각에는 파일명을 통해 login 관련이라는 것을 알 수 있으므로 변수명에서 login을 빼도 될 것 같아요.

Suggested change
const loginButton = document.querySelector('.auth__button');
const loginForm = document.querySelector('form');
const submitButton = document.querySelector('.auth__button');
const form = document.querySelector('form');

Comment on lines +26 to +29
const errorMessage = wrapper.querySelector('.auth__error-message');
if (errorMessage) {
errorMessage.remove();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
해당 코드에서는 동적으로 태그를 삽입하면서 에러 메시지를 렌더링하는 방식입니다.
이렇게되면 계속적으로 DOM 조작을 해야하므로 error message가 들어갈 태그를 미리 만들어주고 에러에 따라 innerText만 변경하는 방식으로 수정하시는 것을 추천드려요.

Comment on lines +38 to +48
const validateEmailInput = () => {
const email = emailInput.value.trim();
hideError(emailInput);

const error = validateEmail(email);
if (error) {
showError(emailInput, error);
}

updateButtonState();
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

💊 제안
해당 함수에 따르면 무조건 hideError 함수가 실행됩니다. showError 함수를 보면 에러메시지를 보여줄 태그가 존재할 경우 재활용을 하기 때문에 hideError도 필요시에만 호출하는 것이 성능과 가독성 측면에서도 좋을 것 같습니다.

Suggested change
const validateEmailInput = () => {
const email = emailInput.value.trim();
hideError(emailInput);
const error = validateEmail(email);
if (error) {
showError(emailInput, error);
}
updateButtonState();
};
const validateEmailInput = () => {
const error = validateEmail(emailInput.value.trim());
if (error) {
showError(emailInput, error);
} else {
hideError(emailInput);
}
updateButtonState();
};

@GANGYIKIM GANGYIKIM merged commit 9a8a93d into codeit-bootcamp-frontend:Basic-박지섭 Mar 27, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants