-
Notifications
You must be signed in to change notification settings - Fork 35
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 #120
The head ref may contain hidden characters: "Basic-\uC5FC\uC131\uC9C4-sprint4"
[염성진] Sprint4 #120
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,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "chrome", | ||
"request": "launch", | ||
"name": "Launch Chrome against localhost", | ||
"url": "http://localhost:5500", | ||
"webRoot": "${workspaceFolder}" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,36 +9,12 @@ | |
<meta property="og:url" content="https://www.codeit.kr" /> | ||
<title>판다마켓</title> | ||
<link rel="stylesheet" href="style.css" /> | ||
<script> | ||
(function (d) { | ||
var config = { | ||
kitId: 'sjs5cbs', | ||
scriptTimeout: 3000, | ||
async: true, | ||
}, | ||
h = d.documentElement, | ||
t = setTimeout(function () { | ||
h.className = h.className.replace(/\bwf-loading\b/g, '') + ' wf-inactive'; | ||
}, config.scriptTimeout), | ||
tk = d.createElement('script'), | ||
f = false, | ||
s = d.getElementsByTagName('script')[0], | ||
a; | ||
h.className += ' wf-loading'; | ||
tk.src = 'https://use.typekit.net/' + config.kitId + '.js'; | ||
tk.async = true; | ||
tk.onload = tk.onreadystatechange = function () { | ||
a = this.readyState; | ||
if (f || (a && a != 'complete' && a != 'loaded')) return; | ||
f = true; | ||
clearTimeout(t); | ||
try { | ||
Typekit.load(config); | ||
} catch (e) {} | ||
}; | ||
s.parentNode.insertBefore(tk, s); | ||
})(document); | ||
</script> | ||
<link | ||
rel="stylesheet" | ||
as="style" | ||
crossorigin | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/variable/pretendardvariable.min.css" | ||
/> | ||
</head> | ||
<body> | ||
<header class="header-nav"> | ||
|
@@ -66,7 +42,11 @@ | |
<main> | ||
<section> | ||
<div class="section-box"> | ||
<img src="image/main/Img_home_hot_item.png" alt="인기 상품 기능 소개 이미지" class="section-image" /> | ||
<img | ||
src="image/main/Img_home_hot_item.png" | ||
alt="인기 상품 기능 소개 이미지" | ||
class="section-image" | ||
/> | ||
<div class="contents"> | ||
<div class="content-category">Hot item</div> | ||
<div class="content-title"> | ||
|
@@ -93,12 +73,20 @@ | |
쉽게 찾아보세요 | ||
</div> | ||
</div> | ||
<img src="image/main/Img_home_item_search.png" alt="검색 기능 소개 이미지" class="section-image" /> | ||
<img | ||
src="image/main/Img_home_item_search.png" | ||
alt="검색 기능 소개 이미지" | ||
class="section-image" | ||
/> | ||
</div> | ||
</section> | ||
<section> | ||
<div class="section-box"> | ||
<img src="image/main/Img_home_for_sale_item.png" alt="상품 등록 기능 소개 이미지" class="section-image" /> | ||
<img | ||
src="image/main/Img_home_for_sale_item.png" | ||
alt="상품 등록 기능 소개 이미지" | ||
class="section-image" | ||
/> | ||
<div class="contents"> | ||
<div class="content-category">Register</div> | ||
<div class="content-title"> | ||
|
@@ -113,21 +101,21 @@ | |
</div> | ||
</section> | ||
</main> | ||
<footer class="footer-contents"> | ||
<div class="footer-contents-background"> | ||
<div class="footer-text-image"> | ||
<div class="footer-text"> | ||
<section class="bottom-contents"> | ||
<div class="bottom-contents-background"> | ||
<div class="bottom-text-image"> | ||
<div class="bottom-text"> | ||
<div class="slogan"> | ||
믿을 수 있는<br /> | ||
판다마켓 중고거래 | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> | ||
</section> | ||
<footer class="footer-link-bar-background"> | ||
<div class="footer-link-bar"> | ||
<div class="codeit">@codeit - 2024</div> | ||
<address class="codeit">@codeit - 2024</address> | ||
<div class="privacy-faq-box"> | ||
<div> | ||
<a href="privacy" class="privacy">Privacy Policy</a> | ||
|
@@ -136,20 +124,30 @@ | |
<a href="faq" class="faq">FAQ</a> | ||
</div> | ||
</div> | ||
<div class="sns-links"> | ||
<a href="/facebook" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_facebook.png" /> | ||
</a> | ||
<a href="/twitter" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_twitter.png" /> | ||
</a> | ||
<a href="/youtube" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_youtube.png" /> | ||
</a> | ||
<a href="/instagram" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_instagram.png" /> | ||
</a> | ||
</div> | ||
<nav class="sns-links"> | ||
<ul> | ||
<li> | ||
<a href="/facebook" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_facebook.png" /> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="/twitter" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_twitter.png" /> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="/youtube" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_youtube.png" /> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="/instagram" target="_blank"> | ||
<img class="sns-link-mini" src="/image//icon/ic_instagram.png" /> | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
</footer> | ||
</body> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<h1>items</h1> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
const $input = document.getElementsByClassName('input'); | ||
const $email = document.getElementById('email'); | ||
const $name = document.getElementById('name'); | ||
const $password = document.getElementById('password'); | ||
const $checkPassword = document.getElementById('checkPassword'); | ||
const $loginBtn = document.getElementsByClassName('login-btn'); | ||
const $form = document.getElementsByClassName('form'); | ||
const $signup = document.getElementsByClassName('signup'); | ||
const $login = document.getElementsByClassName('login'); | ||
const $loginForm = document.getElementById('loginForm'); | ||
const $conditionMessage = document.querySelectorAll('.condition-message'); | ||
const $passwordEye = document.getElementById('passwordEye'); | ||
const $checkPasswordEye = document.getElementById('checkPasswordEye'); | ||
const pattern = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/; | ||
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. 이런 정규표현식 혹은 변하지 않는 값들은 "상수화" 시켜주는 것이 일반적인 방법이에요. *참고 |
||
|
||
const pass = [false, false, false, false]; | ||
|
||
// 인풋 입력값있는지 체크 | ||
function inputCheck(e) { | ||
const $target = e.target; | ||
const $errorMesaage = $target.nextElementSibling; | ||
if ($target.value === '') { | ||
$target.classList.add('error2'); | ||
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. 전 훨씬 좋다고 생각해요! |
||
$errorMesaage.classList.add('waring'); | ||
} else { | ||
$target.classList.remove('error2'); | ||
$errorMesaage.classList.remove('waring'); | ||
} | ||
} | ||
|
||
// 이메일 정규식 체크 | ||
function emailCheck() { | ||
if ($email.value === '') { | ||
$conditionMessage[0].classList.remove('waring'); | ||
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. 하지만 결국 conditionMessage 처럼 querySelector로 가져온 친구들도 DOM 자체이기 때문에 어쨌든 DOM에 클래스명을 추가하는 것이에요 :) |
||
$input[0].classList.remove('error'); | ||
} else if (!pattern.test($email.value)) { | ||
$conditionMessage[0].classList.add('waring'); | ||
$input[0].classList.add('error'); | ||
} else { | ||
$conditionMessage[0].classList.remove('waring'); | ||
$input[0].classList.remove('error'); | ||
} | ||
} | ||
|
||
// 비밀번호 8글자 이상인지 체크 | ||
function passwordCheck(e) { | ||
if (e.target.id === 'password') { | ||
const $target = e.target; | ||
const $Message = $target.nextElementSibling.nextElementSibling; | ||
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. 앞으로는 변수명에도 컨벤션 (일정한 규칙) 이 있어야해요 |
||
if ($target.value.length < 8 && $target.value.length > 0) { | ||
$Message.classList.add('waring'); | ||
$target.classList.add('error'); | ||
} else { | ||
$Message.classList.remove('waring'); | ||
$target.classList.remove('error'); | ||
} | ||
} | ||
} | ||
// 비밀번호 재확인 체크 | ||
function ReCheckPassword() { | ||
if ($password.value !== $checkPassword.value) { | ||
$conditionMessage[2].classList.add('waring'); | ||
$input[3].classList.add('error'); | ||
} else { | ||
$conditionMessage[2].classList.remove('waring'); | ||
$input[3].classList.remove('error'); | ||
} | ||
} | ||
|
||
// 조건 충족했는지 체크 | ||
function meetsCondition() { | ||
for (let i = 0; i < $input.length; i++) { | ||
if ($input[i].value !== '') { | ||
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. const isError = $input[i].classList.contains('error') || $input[i].classList.contains('error2')
pass.splice(i, 1, isError ? false : true) 요런식으로 코드를 바꿔볼 수 있겠네요 제가 위에서 사용한 건 "삼항 연산자"입니다! |
||
if ($input[i].classList.contains('error') || $input[i].classList.contains('error2')) { | ||
pass.splice(i, 1, false); | ||
} else { | ||
pass.splice(i, 1, true); | ||
} | ||
} | ||
} | ||
} | ||
|
||
// 모든 조건을 충족했는지 체크 후 충족했다면 버튼 활성화 | ||
function meetAallConditions() { | ||
if ($input.length === 2) { | ||
const loginPass = pass.slice(0, 2); | ||
if (loginPass.every((value) => value === true)) { | ||
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. 요기도 if문이 중복으로 쓰였는데 다른 방법은 없을까요!? |
||
$loginBtn[0].classList.add('accept'); | ||
} else { | ||
$loginBtn[0].classList.remove('accept'); | ||
} | ||
} else if (pass.every((value) => value === true)) { | ||
$loginBtn[0].classList.add('accept'); | ||
} else { | ||
$loginBtn[0].classList.remove('accept'); | ||
} | ||
} | ||
|
||
// 포커스 아웃 시에 함수들을 실행하여 조건 확인 | ||
$loginForm.addEventListener('focusout', (e) => { | ||
emailCheck(); | ||
passwordCheck(e); | ||
if ($input.length === 4) { | ||
ReCheckPassword(); | ||
} | ||
inputCheck(e); | ||
meetsCondition(); | ||
meetAallConditions(); | ||
}); | ||
|
||
// 모든 조건 만족 시 submit 하여 페이지 이동 | ||
$loginForm.addEventListener('submit', (e) => { | ||
e.preventDefault(); | ||
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. 혹시 e.preventDefault() vs e.stopPropagination()의 차이점을 아시나요? 모르신다면 아래 아티클을 공부해보시면 좋을 것 같아요 👍 |
||
meetsCondition(); | ||
meetAallConditions(); | ||
if ($loginBtn[0].classList.contains('accept')) { | ||
if ($input.length === 2) { | ||
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. 여기서도 삼항연산자로 한번 바꿔보시겠어요!? |
||
window.location.href = '/items'; | ||
} else { | ||
window.location.href = '/signin'; | ||
} | ||
} | ||
}); | ||
|
||
// 패스워드 눈알 아이콘 클릭 시 패스워드 보임/숨김 변경 | ||
$passwordEye.addEventListener('click', () => { | ||
if ($password.type === 'text') { | ||
$password.type = 'password'; | ||
$passwordEye.src = 'image/icon/btn_icon/visibilty_off.png'; | ||
} else { | ||
$password.type = 'text'; | ||
$passwordEye.src = 'image/icon/btn_icon/visibilty_on.png'; | ||
} | ||
}); | ||
$checkPasswordEye.addEventListener('click', () => { | ||
if ($checkPassword.type === 'text') { | ||
$checkPassword.type = 'password'; | ||
$checkPasswordEye.src = 'image/icon/btn_icon/visibilty_off.png'; | ||
} else { | ||
$checkPassword.type = 'text'; | ||
$checkPasswordEye.src = 'image/icon/btn_icon/visibilty_on.png'; | ||
} | ||
}); |
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.
targe="_blank"
는rel="noopener norefferer"
와 함께 사용됩니다(거의 세트로)이유는 아래 아티클로 첨부해드릴게요!
https://velog.io/@parkseonup/noopener%EC%99%80-noreferrer