-
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
The head ref may contain hidden characters: "Basic-\uC720\uACBD\uBBFC-sprint4"
[유경민] sprint4 #86
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "arrowParens": "always", | ||
| "bracketSameLine": false, | ||
| "objectWrap": "preserve", | ||
| "bracketSpacing": true, | ||
| "semi": true, | ||
| "experimentalOperatorPosition": "end", | ||
| "experimentalTernaries": false, | ||
| "singleQuote": true, | ||
| "jsxSingleQuote": false, | ||
| "quoteProps": "as-needed", | ||
| "trailingComma": "all", | ||
| "singleAttributePerLine": false, | ||
| "htmlWhitespaceSensitivity": "css", | ||
| "vueIndentScriptAndStyle": false, | ||
| "proseWrap": "preserve", | ||
| "insertPragma": false, | ||
| "printWidth": 80, | ||
| "requirePragma": false, | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "embeddedLanguageFormatting": "auto" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| body { | ||
| margin: 0; | ||
| font-family: 'Pretendard' ; | ||
| font-family: 'Pretendard'; | ||
| } | ||
|
|
||
| .login-wrapper { | ||
|
|
@@ -20,12 +20,13 @@ body { | |
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| margin-bottom: 40px; | ||
| } | ||
|
|
||
| .logo-img { | ||
| width: 396px; | ||
| height: 132px; | ||
| display: block; | ||
| display: block; | ||
| } | ||
|
|
||
| /*입력창*/ | ||
|
|
@@ -38,19 +39,19 @@ label { | |
| font-size: 18px; | ||
| font-weight: 700; | ||
| margin-bottom: 16px; | ||
| color: #1F2937; | ||
| color: #1f2937; | ||
| } | ||
|
|
||
| input[type="email"], | ||
| input[type="password"], | ||
| input[type="text"]{ | ||
| input[type='email'], | ||
| input[type='password'], | ||
| input[type='text'] { | ||
| width: 100%; | ||
| height: 48px; | ||
| height: 56px; | ||
| font-size: 15px; | ||
| padding: 16px; | ||
| padding: 16px; | ||
| border-radius: 12px; | ||
| border: none; | ||
| background-color: #F3F4F6; | ||
| background-color: #f3f4f6; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
|
|
@@ -67,7 +68,7 @@ input[type="text"]{ | |
| margin: 16 48 48 48px; | ||
| border-radius: 12px; | ||
| box-sizing: border-box; | ||
| background-color: #F3F4F6; | ||
| background-color: #f3f4f6; | ||
| border: none; | ||
| font-size: 16px; | ||
| } | ||
|
|
@@ -90,12 +91,11 @@ input[type="text"]{ | |
| height: 100%; | ||
| } | ||
|
|
||
|
|
||
| /*로그인 버튼*/ | ||
| .login-btn { | ||
| width: 100%; | ||
| height: 56px; | ||
| background-color: #9CA3AF; | ||
| background-color: #9ca3af; | ||
| color: #ffffff; | ||
| font-weight: 600; | ||
| font-size: 20px; | ||
|
|
@@ -105,7 +105,7 @@ input[type="text"]{ | |
|
|
||
| /*간편 로그인*/ | ||
| .social-login { | ||
| background-color: #E6F2FF; | ||
| background-color: #e6f2ff; | ||
| height: 74px; | ||
| display: flex; | ||
| justify-content: space-between; | ||
|
|
@@ -136,11 +136,11 @@ input[type="text"]{ | |
| font-size: 14px; | ||
| font-weight: 500; | ||
| text-align: center; | ||
| color: #1F2937; | ||
| color: #1f2937; | ||
| } | ||
|
|
||
| .signup-callout a { | ||
| color: #3182F6; | ||
| color: #3182f6; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 컬러 팔레트를 사용해보시는건 어떨까요? 🎨컬러는 따로 선언해두시고 재사용 해보시는건 어떨까요? :root {
--primary: #6D6AFE;
--red: #FF5B56;
--black: #111322;
--white: #FFFFFF;
--gray-100: #3E3E43;
--gray-200: #9FA6B2;
--gray-300: #CCD5E3;
--gray-400: #E7EFFB;
--gray-500: #F0F6FF;
} |
||
| font-size: 14px; | ||
| font-weight: 500; | ||
| } | ||
|
|
@@ -155,4 +155,28 @@ input[type="text"]{ | |
| } | ||
| } | ||
|
|
||
| /*에러 메세지*/ | ||
| .error-input { | ||
| border: 1px solid #f74747 !important; | ||
| } | ||
|
|
||
| .correct-input { | ||
| border: 1px solid #3692ff !important; | ||
| } | ||
|
|
||
| .error-message { | ||
| color: #f74747; | ||
| font-size: 14px; | ||
| font-weight: 600; | ||
| margin-top: 10px; | ||
| display: block; | ||
| } | ||
|
|
||
| /*로그인 버튼 활성화*/ | ||
| .login-btn.enabled { | ||
| background-color: #3692ff; | ||
| } | ||
|
|
||
| .login-btn:disabled { | ||
| cursor: not-allowed; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,83 @@ | ||
| function inputPassword(inputId, eyeId) { | ||
| const passwordInput = document.getElementById(inputId); | ||
| const eyeIcon = document.getElementById(eyeId); | ||
|
|
||
| if (passwordInput.type === "password") { | ||
| passwordInput.type = "text"; | ||
| eyeIcon.src = "images/eye-on.png"; | ||
| } else { | ||
| passwordInput.type = "password"; | ||
| eyeIcon.src = "images/eye-off.png"; | ||
| } | ||
| } | ||
| const passwordInput = document.getElementById(inputId); | ||
| const eyeIcon = document.getElementById(eyeId); | ||
|
|
||
| if (passwordInput.type === 'password') { | ||
| passwordInput.type = 'text'; | ||
| eyeIcon.src = 'images/eye-on.svg'; | ||
| } else { | ||
| passwordInput.type = 'password'; | ||
| eyeIcon.src = 'images/eye-off.svg'; | ||
| } | ||
| } | ||
|
|
||
| document.addEventListener('DOMContentLoaded', function () { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 굿굿 ! 적절한 이벤트 리스너네요 👍이렇게 되면 DOM이 로드가 된 후 순서를 보장할 수 있으며, 글로벌 스코프를 방지할 수 있겠어요 |
||
| const emailInput = document.getElementById('email'); | ||
| const emailError = document.getElementById('email-error'); | ||
| const passwordInput = document.getElementById('password'); | ||
| const passwordError = document.getElementById('password-error'); | ||
| const loginButton = document.getElementById('login-button'); | ||
|
|
||
| function validateEmail(email) { | ||
| const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; | ||
| return emailRegex.test(email); | ||
| } | ||
|
Comment on lines
+21
to
+24
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 크으 ~ 순수 함수를 구현하시다니 👍해당 함수는 입력값(email)이 같으면 언제나 같은 결과(true/false)를 반환하고 외부 상태에 영향을 주거나 의존하지도 않아요. 이러한 구조는 테스트하기도 쉽고, 예측 가능한 코드 작성에 도움이 되는 좋은 패턴입니다. |
||
|
|
||
| function updateButtonState() { | ||
| const emailValue = emailInput.value.trim(); | ||
| const passwordValue = passwordInput.value.trim(); | ||
| const emailValid = emailValue !== '' && validateEmail(emailValue); | ||
| const passwordValid = passwordValue !== '' && passwordValue.length >= 8; | ||
| if (emailValid && passwordValid) { | ||
|
Comment on lines
+27
to
+31
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 별칭을 작성해서 가독성을 높이셨군요 ! 깔끔합니다!
다만 보통 |
||
| loginButton.disabled = false; | ||
| loginButton.classList.add('enabled'); | ||
| } else { | ||
| loginButton.disabled = true; | ||
| loginButton.classList.remove('enabled'); | ||
| } | ||
| } | ||
|
|
||
| emailInput.addEventListener('input', function () { | ||
| const value = emailInput.value.trim(); | ||
| if (value === '') { | ||
| emailInput.classList.add('error-input'); | ||
| emailError.textContent = '이메일을 입력해주세요.'; | ||
| emailError.style.display = 'block'; | ||
| } else if (!validateEmail(value)) { | ||
| emailInput.classList.add('error-input'); | ||
| emailError.textContent = '잘못된 이메일 형식입니다.'; | ||
| emailError.style.display = 'block'; | ||
| } else { | ||
| emailInput.classList.remove('error-input'); | ||
| emailError.textContent = ''; | ||
| emailError.style.display = 'none'; | ||
| } | ||
| updateButtonState(); | ||
| }); | ||
|
|
||
| passwordInput.addEventListener('input', function () { | ||
| const value = passwordInput.value.trim(); | ||
| if (value === '') { | ||
| passwordInput.classList.add('error-input'); | ||
| passwordError.textContent = '비밀번호를 입력해주세요.'; | ||
| passwordError.style.display = 'block'; | ||
| } else if (value.length < 8) { | ||
| passwordInput.classList.add('error-input'); | ||
| passwordError.textContent = '비밀번호를 8자 이상 입력해주세요.'; | ||
| passwordError.style.display = 'block'; | ||
| } else { | ||
| passwordInput.classList.remove('error-input'); | ||
| passwordError.textContent = ''; | ||
| passwordError.style.display = 'none'; | ||
| } | ||
| updateButtonState(); | ||
| }); | ||
|
|
||
| loginButton.addEventListener('click', function () { | ||
| if (!this.disabled) { | ||
| window.location.href = '/items'; | ||
| } | ||
| }); | ||
|
|
||
| updateButtonState(); | ||
| }); | ||
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를 선택자로 사용하는게 어떨까요?클래스는 재사용이 가능하며, 자유롭게 태그에 스타일을 붙일 수 있어서 유지보수에 용이하므로 단순히 스타일을 위해서라면
class를 추천드려요 !좀 더 자세히 🤔
유지보수가 어려워질 수 있어요.
특정
p태그에만 다른 스타일을 적용하려면 추가적인 선택자를 작성하거나 기존 스타일을 덮어써야 하므로 유지보수가 어려워집니다.태그 의미를 명확히 부여하기 어려워요.
스타일링을 태그에 직접 적용하면, 태그가 어떤 의미를 가지는지 어렵기에 가독성이 보다 좋지 못할 수 있어요.
물론 전역적인 것을 의미한다면 일정 허용될 수 있어요.
예를 들어서
p의 기본 마진을 없애고 싶다면 다음과 같이 작성할 수 있을거예요:그렇지만 특정 스타일을 지정하고 싶다면 다음과 같이 작성해볼 수 있어요: