-
Notifications
You must be signed in to change notification settings - Fork 0
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
[2주차 기본/심화/생각 과제 ] 웨비의 사진관 😋/가계부 #2
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,3 @@ | |||
{ | |||
"liveServer.settings.port": 5501 | |||
} |
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.
오엥?
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.
어라 5500포트로 다른 거 돌아가고 잇나...?
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.
켈록켈록...아마 두 개를 동시에 돌렸나 봄...큼큼큼
|
||
inCategory.addEventListener("keypress",createCateogry); | ||
outCategory.addEventListener("keypress",createCateogry); | ||
|
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.
키햐,,,심화과제 팜미,,,
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.
요기 createCateogry 부분 스펠링 오타 있어.....ㅎ
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.
오우싯~ㅋ;; 민망이슈;;
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.
현재 keypress는 deprecated된 이벤트리스너여서 keydown사용을 권장합니다!
<hr> | ||
<section id="list_wrapper"> | ||
<ul> | ||
</ul> |
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.
요기 빈 ul 안에는 js파일에서 무언가가 들어가는 곳인가여?!
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.
맞슴다!! 렌더링 하면서 리스트 항목이 들어가는 곳!!
type: "output", | ||
name: "쇼핑" | ||
} | ||
]; |
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.
상수파일 따로 뺀거 구웃-!
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.
22!!!!👍🏻👍🏻
: list.className = "list_output"; | ||
|
||
let amount = element.amount.toLocaleString(); | ||
amount = element.type === "input" ? `+${amount}` : `-${amount}`; |
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.
삼항연산자 활용 굿~
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.
굿굿~
val = val.replace(/,/g,""); | ||
|
||
if(val.match(/[^0-9]/g)){ | ||
val = val.replace(/[^0-9]/g,""); |
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.
이햐 정규표현식까지,,,,🔥
}; | ||
} | ||
|
||
loadCategory(); |
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.
심화과제까지 마친 가형스,,,폼미,,,,
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.
심화과제까지 마친 가형스,,,폼미,,,,
222,,,,, 폼미!!
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.
333..폼미폼미폼미폼미
let tempOutput = INIT_BALANCE; | ||
let tempAsset = INIT_BALANCE; | ||
|
||
const totalInput = document.querySelector(".total_inout :nth-child(2)"); |
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.
지난기수에 멘토님들 오셨을 때 들었던 얘기인데, 선택자로 nth-child를 쓰는게 나중에 예상치 못한 문제를 일으키는 경우가 많아서 지양한다고 하셨거든!! 지금은 스케일이 작아서 괜찮지만 코드가 많아지면 이거 찾는것도 은근 일이라,,! 선택하는 다른 방법은 없는지 생각해보면 좋을듯!
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.
지난기수에 멘토님들 오셨을 때 들었던 얘기인데, 선택자로 nth-child를 쓰는게 나중에 예상치 못한 문제를 일으키는 경우가 많아서 지양한다고 하셨거든!! 지금은 스케일이 작아서 괜찮지만 코드가 많아지면 이거 찾는것도 은근 일이라,,! 선택하는 다른 방법은 없는지 생각해보면 좋을듯!
헐 좋은 거 배워가요!!🙏🏻
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.
지난기수에 멘토님들 오셨을 때 들었던 얘기인데, 선택자로 nth-child를 쓰는게 나중에 예상치 못한 문제를 일으키는 경우가 많아서 지양한다고 하셨거든!! 지금은 스케일이 작아서 괜찮지만 코드가 많아지면 이거 찾는것도 은근 일이라,,! 선택하는 다른 방법은 없는지 생각해보면 좋을듯!
음음 맞는 것 같아!! 알려줘서 고맙💕
<a href="./category.html"><img src="./category.png" class="btn" id="category_btn"></a> | ||
</footer> | ||
<script src="main.js" type="module"></script> | ||
<script src="modal.js" type="module"></script> |
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.
type='module'
굿~!
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.
진짜진짜 고생햇다아ㅏ 멋진와비 고.가.형.~!!〰️🔥
@@ -0,0 +1,3 @@ | |||
{ | |||
"liveServer.settings.port": 5501 | |||
} |
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.
어라 5500포트로 다른 거 돌아가고 잇나...?
const list = document.createElement("li"); | ||
|
||
list.innerHTML = ` | ||
<span>${element.name}</span> |
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.
템플릿 리터럴 활용 조아요👏🏻👏🏻
function addStorage(element){ | ||
localStorage.setItem(localStorage.length, JSON.stringify(element)); | ||
} |
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.
key 값을 현재 로컬스토리지 length로 줘서 아이템 추가될때마다 순차적으로 인덱스 부여받도록 한 건가?? 신박하다😮
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.
엉,,ㅋㅋㅋ key 값을 도저히 뭘로 줘야될 지 모르겠더라고,,!!! 먼가 symbol을 써도 될 것 같기도 하고?! 일단 저 때는 제 최선이었슴다....
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.
보통 key값은 해당 값이 무엇인지를 나타낼 수 있는 값으로 지정해줘요 ! 그래야 각 값의 key가 뭔지 매번 보지 않고, 해당하는 명명값만을 가지고 getItem을 할 수 있으니까용 !
|
||
inCategory.addEventListener("keypress",createCateogry); | ||
outCategory.addEventListener("keypress",createCateogry); | ||
|
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.
요기 createCateogry 부분 스펠링 오타 있어.....ㅎ
type: "output", | ||
name: "쇼핑" | ||
} | ||
]; |
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.
22!!!!👍🏻👍🏻
let tempOutput = INIT_BALANCE; | ||
let tempAsset = INIT_BALANCE; | ||
|
||
const totalInput = document.querySelector(".total_inout :nth-child(2)"); |
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.
지난기수에 멘토님들 오셨을 때 들었던 얘기인데, 선택자로 nth-child를 쓰는게 나중에 예상치 못한 문제를 일으키는 경우가 많아서 지양한다고 하셨거든!! 지금은 스케일이 작아서 괜찮지만 코드가 많아지면 이거 찾는것도 은근 일이라,,! 선택하는 다른 방법은 없는지 생각해보면 좋을듯!
헐 좋은 거 배워가요!!🙏🏻
|
||
tempAsset = tempInput-tempOutput; | ||
|
||
totalInput.innerHTML = `${tempInput.toLocaleString()}`; |
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.
toLocaleString 이거 날짜 포맷팅할때만 사용해봤는데 숫자도 포맷팅해주는구나!!! 처음 알았어😮
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.
나두 검색하다 안 사실,,,,,약간 편법이긴 한데,,,정석인 방법이 나에겐 너무 버거웠,,,,
: element.type = "output"; | ||
|
||
let val = list.innerHTML; | ||
val = parseInt(val.replace(/[,+-]/g,"")); |
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.
정규표현식까지,,,,,👍🏻👍🏻 +, - 기호 제거해주는 표현식인가??
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.
웅!! JS 안에서 자산 계산할 때는 숫자 타입으로 돌아다녀야 되니까 amount string에서 특수 기호들만 골라서 빼줬슴당!!
}; | ||
} | ||
|
||
loadCategory(); |
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.
심화과제까지 마친 가형스,,,폼미,,,,
222,,,,, 폼미!!
function onHover(e){ | ||
e.target.children[0].style.filter = "brightness(0.5)" | ||
e.target.children[1].style.display ="inline"; | ||
e.target.children[2].style.display ="-webkit-box"; |
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.
이건 어떻게 동작하는 코드야?? 궁금쓰
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.
기본 과제는 flex로만 하면 되는데 3줄 이상 줄넘김 지정해주려고 display 값을 "-webkit-box"로 지정해줬다!! 크롬이랑 사파리에 내장된 extensions 같은데,,,요즘은 잘 안 쓰는 것 같기는 해 ㅎㅅㅎ (근데 다른 방법을 못 찾아뜸...)
http://dolly77.tistory.com/9<< 요기 참고해바
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.
기본 과제는 flex로만 하면 되는데 3줄 이상 줄넘김 지정해주려고 display 값을 "-webkit-box"로 지정해줬다!! 크롬이랑 사파리에 내장된 extensions 같은데,,,요즘은 잘 안 쓰는 것 같기는 해 ㅎㅅㅎ http://dolly77.tistory.com/9<< 요기 참고해바
너무 신기해... 유익해.......
심화과제까지 하느라 넘 고생했어!!! 멋지다 가형쓰 👏🏻👏🏻👏🏻 덕분에 많이 배워가 :) |
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.
많이 배워 갑니다 :)
|
||
inCategory.addEventListener("keypress",createCateogry); | ||
outCategory.addEventListener("keypress",createCateogry); | ||
|
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.
현재 keypress는 deprecated된 이벤트리스너여서 keydown사용을 권장합니다!
for (let key of keys){ | ||
let objOption = document.createElement("li"); |
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.
함수형 프로그래밍을 위해 forEach사용을 권장합니다!
그리고 노드의 element를 만들거나 가져올 때는 const 사용을 해보는게 어떨까요??
@import "./reset.css"; | ||
@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap'); | ||
|
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.
@import 방법으로 import 하는 것은 성능 문제가 발생할 수 있어요!
https://webclub.tistory.com/127
:root{ | ||
/*color*/ | ||
--main-color: #bedaba; | ||
--sub-color01: #F6F6F6; | ||
--sub-color02: #fdcfcf; | ||
--sub-color03: #f7f7e1; | ||
} |
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.
이런 변수 선언 후 코드 가독성 높이는거 너무 좋은 것 같아요
const inputBox = document.getElementById("input_box"); | ||
const outputBox = document.getElementById("output_box"); |
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 선택자와 id선택자를 섞어서 사용하면 우선순위 때문에 추후 유지보수에 어려움을 가질 수 있어요! id선택자를 쓰신 이유가 있을까요??
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.
id 밖에 안 붙어있었,,따,,!!
: list.className = "list_output"; | ||
|
||
let amount = element.amount.toLocaleString(); | ||
amount = element.type === "input" ? `+${amount}` : `-${amount}`; |
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.
굿굿~
const modalWrapper =document.querySelector(".modal_wrapper"); | ||
const modalBtn = document.getElementById("add_btn"); | ||
const closeBtn = document.getElementById("close"); |
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.
변수명 코드컨벤션 맞춘거 아주 좋아요~!
width: 70%; | ||
height: 40%; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 2rem; | ||
|
||
background-color: var(--main-color); |
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.
필수는 아니지만 css 코드 컨벤션도 있어요!
모질라 css 컨벤션(순서)이나, styleLint를 알아보면 좋을 것 같아요!
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.
금잔디 아닌데 리뷰 해줘서 감쟈합니다 재훈재훈님🙇♀️
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.
심화과제까지 진짜 진짜 폼미 .. 🔥🔥 고민한 흔적이 가득 보인다 .. 너무 고생 많았어요 ! !
element.target.id === "categorypg_input" | ||
? tempVal.type = "input" | ||
: tempVal.type = "output"; |
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.
element.target.id === "categorypg_input" | |
? tempVal.type = "input" | |
: tempVal.type = "output"; | |
tempVal.type = element.target.id === "categorypg_input" | |
? "input" : "output"; |
요렇게 사용하면 된답니당 ~!
function createCateogry(element){ | ||
if(element.keyCode === 13){ |
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.
function createCateogry(element){ | |
if(element.keyCode === 13){ | |
function createCateogry(event){ | |
if(event.keyCode === 13){ |
여기는 event 객체를 받아오는거니까, e나 event로 변수명을 지어줘야 event객체를 사용하고 있구나 한 눈에 알아보기 쉽겠죠 ?!
function addStorage(element){ | ||
localStorage.setItem(localStorage.length, JSON.stringify(element)); | ||
} |
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.
보통 key값은 해당 값이 무엇인지를 나타낼 수 있는 값으로 지정해줘요 ! 그래야 각 값의 key가 뭔지 매번 보지 않고, 해당하는 명명값만을 가지고 getItem을 할 수 있으니까용 !
/[0-9]/g.test(event.target.value) === false | ||
? event.target.value = "" | ||
:event.target.value = parseInt(val).toLocaleString(); |
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.
/[0-9]/g.test(event.target.value) === false | |
? event.target.value = "" | |
:event.target.value = parseInt(val).toLocaleString(); | |
const TEXT_EXPRESSION = /[0-9]/g; | |
event.target.value = TEXT_EXPRESSION.test(event.target.value) | |
? parseInt(val).toLocaleString() : "" ; |
요로코롬 가능하죠! 정규표현식 같은 경우엔 이렇게 상수화해서 빼주는게 좋답니당 ! 추후 유지보수할 때 바뀔 경우 유용하기도 하구요!
let tempAmount = newAmount.value; | ||
let tempTitle = newTitle.value; | ||
|
||
if(tempCategory === ''|| tempAmount === ''|| tempTitle === ''){ |
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.
if(tempCategory === ''|| tempAmount === ''|| tempTitle === ''){ | |
if (!tempCategory || !tempTitle || !tempPrice) { |
빈 문자열은 falsy값이라서 이렇게도 가능하답니다!
}; | ||
} | ||
|
||
loadCategory(); |
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.
333..폼미폼미폼미폼미
if(inputBox.checked){ | ||
showList(inputList); | ||
} | ||
else{ | ||
hideList(inputList); | ||
} |
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.
if(inputBox.checked){ | |
showList(inputList); | |
} | |
else{ | |
hideList(inputList); | |
} | |
inputBox.checked ? showList(inputList) : hideList(inputList); |
요로코롬 삼항연산자는 어떤가용?
for (var i = 0; i < hoverTarget.length; i++) { | ||
hoverTarget[i].addEventListener('mouseenter', onHover); | ||
hoverTarget[i].addEventListener('mouseleave', outHover); | ||
} |
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.
선언형 프로그래밍을 위해!
for (var i = 0; i < hoverTarget.length; i++) { | |
hoverTarget[i].addEventListener('mouseenter', onHover); | |
hoverTarget[i].addEventListener('mouseleave', outHover); | |
} | |
hoverTarget.forEach((target) => { | |
target.addEventListener('mouseenter', onHover); | |
target.addEventListener('mouseleave', outHover); | |
}) |
그리고 하나 하나 지금 돌아가면서 EventListener를 붙여주고 잇는데 조금 더 심화지만 이벤트 위임을 이용하면 이렇게 하지 않아도 된답니당 ㅎㅎ 참고 ~
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.
유용유용❤ 팟짱의 코리 완전 땡큐💞
if (e.clientHeight < e.scrollHeight){ | ||
e.parentNode.appendChild(moreBtn); | ||
} |
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.
와우 이렇게 동적으로 잘해냈다닉
✨ 구현 기능 명세
웨비의 사진관 😋
📌 기본 과제
✅ 1. 이미지 (첫번째 섹션만 해당)
✅ 2. top 버튼
📌 심화 과제
✅ 1. 이미지
✅ 2. preview section
가계부💸
📌 기본 과제
✅ 1. 최초 데이터
✅ 2. 총수입 / 총지출
✅ 3. 수입/지출 필터링
✅ 4. 리스트 삭제
✅ 5. 리스트 추가 (하단 footer의 + 버튼을 누르면 리스트 추가 모달이 나타납니다.)
📌 심화 과제
✅ 1. 리스트 삭제 모달
✅ 2. 리스트 추가
✅ 3. 모달 백그라운드 & 애니메이션 (삭제, 추가)
✅ 4. 카테고리 추가 (
localStorage
를 활용합니다.)✅ 5. 금액
📌 생각 과제
✅
💎 PR Point
3가지를 계속 리마인드 하려면서 구현하려고 했습니다!
코드를 짜는데 2번 하고 3번 하고 상충하는 경우가 왕왕 발생해서 아쉽긴 하지만,,,!
나름 고민을 많이 하고 코드를 짰습니다ㅎㅎ
웨비의 사진관 😋
✔ top 버튼 투명도 조절
✔ 이미지 정보 더보기 버튼과 말줄임표
display: -webkit-box
가 안 먹어서 새벽 6시에 화면에다가 주먹질 했는데 황당무계하게도 상위 CSS에 묻혔더군요,,,mouseenter
랑 mouseleave`와도 연동해서 마우스가 컨테이너 밖으로 빠져 나갈 때, 초기 상태로 리셋되게 만들었습니다. 그리고 더보기 버튼을 안 누른 상태로 빠져 나가도 CSS와 JS가 적용될 수 있게끔 구현했습니당!가계부💸
✔ 리스트 삭제 컨펌 모달
예
버튼을 눌렀을 때,li
가 타깃 요소가 아닌데 어떻게 불러와야될 지 고민을 많이 했습니다.✔ 리스트 추가 모달 입력 제한
click
될 때마다 함수를 불러올 수 있게 코드를 짰는데 한글은 인식이 안된다는 문제가 있다고 해서keypress
로 갈아탔습니다.keyCode
값이 읽기 전용이라), 그래서input
일 때마다 함수가 실행될 수 있도록 수정했습니다.✔ 리스트 추가 모달 애니메이션 효과
background filter
나backdrop
으로 해결하려고 했습니다.div
가 생길 수 있도록 바꾸었습니다.transition
아직도 어려워요💫🥺 소요 시간, 어려웠던 점
웨비의 사진관 😋
🗨
10h
정도?가계부💸
🗨
30h
정도,,? (맨날 이것만 했더니 감이 안 잡힌다며...)🌈 구현 결과물
[드라이브 링크]https://drive.google.com/drive/folders/1VlsDnislZKH4zcQf9BchpnYBA7h8hfqD?usp=sharing