-
Notifications
You must be signed in to change notification settings - Fork 26
[유경민] sprint4 #86
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
[유경민] sprint4 #86
The head ref may contain hidden characters: "Basic-\uC720\uACBD\uBBFC-sprint4"
Conversation
|
스프리트 미션 하시느라 수고 많으셨어요. |
| input[type='email'], | ||
| input[type='password'] { |
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.
(제안) 만약 스타일 선택자 목적이라면 태그보다는 class를 선택자로 사용하는게 어떨까요?
| input[type='email'], | |
| input[type='password'] { | |
| .input[type='email'], | |
| .input[type='password'] { |
클래스는 재사용이 가능하며, 자유롭게 태그에 스타일을 붙일 수 있어서 유지보수에 용이하므로 단순히 스타일을 위해서라면 class를 추천드려요 !
좀 더 자세히 🤔
유지보수가 어려워질 수 있어요.
특정 p 태그에만 다른 스타일을 적용하려면 추가적인 선택자를 작성하거나 기존 스타일을 덮어써야 하므로 유지보수가 어려워집니다.
태그 의미를 명확히 부여하기 어려워요.
스타일링을 태그에 직접 적용하면, 태그가 어떤 의미를 가지는지 어렵기에 가독성이 보다 좋지 못할 수 있어요.
만약 다음 코드의 스타일을 태그 선택자로만 지정한다면 ?
<p class="error-message">오류가 발생했습니다.</p>물론 전역적인 것을 의미한다면 일정 허용될 수 있어요.
예를 들어서 p의 기본 마진을 없애고 싶다면 다음과 같이 작성할 수 있을거예요:
p {
margin: 0;
}그렇지만 특정 스타일을 지정하고 싶다면 다음과 같이 작성해볼 수 있어요:
.paragraph {
font-size: 16px;
color: #333;
}
.highlight {
background-color: yellow;
}|
|
||
| .signup-callout a { | ||
| color: #3182F6; | ||
| color: #3182f6; |
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.
컬러 팔레트를 사용해보시는건 어떨까요? 🎨
컬러는 따로 선언해두시고 재사용 해보시는건 어떨까요?
컬러 팔레트는 color.css 혹은 global.css에서 정의하는게 일반적입니다 !
컬러 팔레트는 다음과 같이 정의할 수 있습니다:
:root {
--primary: #6D6AFE;
--red: #FF5B56;
--black: #111322;
--white: #FFFFFF;
--gray-100: #3E3E43;
--gray-200: #9FA6B2;
--gray-300: #CCD5E3;
--gray-400: #E7EFFB;
--gray-500: #F0F6FF;
}| } | ||
| } | ||
|
|
||
| document.addEventListener('DOMContentLoaded', function () { |
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.
굿굿 ! 적절한 이벤트 리스너네요 👍
이렇게 되면 DOM이 로드가 된 후 순서를 보장할 수 있으며, 글로벌 스코프를 방지할 수 있겠어요
| function validateEmail(email) { | ||
| const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; | ||
| return emailRegex.test(email); | ||
| } |
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.
크으 ~ 순수 함수를 구현하시다니 👍
해당 함수는 입력값(email)이 같으면 언제나 같은 결과(true/false)를 반환하고 외부 상태에 영향을 주거나 의존하지도 않아요.
이런 함수를 “순수 함수(Pure Function)” 라고 부릅니다.
이러한 구조는 테스트하기도 쉽고, 예측 가능한 코드 작성에 도움이 되는 좋은 패턴입니다.
지금처럼 유틸리티 함수를 순수하게 분리해 작성하는 습관, 정말 잘 하고 계세요! 🔥
| const emailValue = emailInput.value.trim(); | ||
| const passwordValue = passwordInput.value.trim(); | ||
| const emailValid = emailValue !== '' && validateEmail(emailValue); | ||
| const passwordValid = passwordValue !== '' && passwordValue.length >= 8; | ||
| if (emailValid && passwordValid) { |
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.
별칭을 작성해서 가독성을 높이셨군요 ! 깔끔합니다!
emailValid, passwordValid 등. 조건문을 인라인으로 바로 사용하지 않고 별칭을 사용해서 가독성이 훨씬 좋아졌네요 👍
다만 보통 boolean은 is~로 시작하는게 일반적입니다
| type="email" | ||
| id="email" | ||
| required | ||
| placeholder="이메일을 입력해주세요" | ||
| /> |
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.
굿굿 ~ 유효한 속성들이 추가되었군요 ! 👍👍
| <button | ||
| type="button" | ||
| class="btn" | ||
| onclick="inputPassword('password', 'eye-icon')" | ||
| > |
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.
submit 이벤트에 리스너를 등록해도 될 것 같아요.
예를 들어 폼 내에서
enter로 제출을 시도하게 되면 어떻게 될까요?
일반적으로 엔터 혹은 탭을 통해 버튼을 클릭할 수도 있어요.
enter로 제출하면 해당 버튼의 비밀번호 유효성 검사가 실행되지 않을거예요 ! 😊
|
수고하셨습니다 경민님 ! |
✅ 체크리스트 [기본]
🔐 로그인
📝 회원가입
✨ 체크리스트 [심화]
배포사이트
https://pandapandapanda.netlify.app/login
https://pandapandapanda.netlify.app/signup
주요 변경사항
스크린샷
로그인
회원가입
멘토에게