-
Notifications
You must be signed in to change notification settings - Fork 1
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
[3주차] 과제 이나현 #2
base: main
Are you sure you want to change the base?
[3주차] 과제 이나현 #2
Conversation
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.
왕 진짜 최고 !!!!!!!!! 너무 이뻐요 :D
Modal 창 위치나 CSS 적용이 card랑 겹쳐서 헷갈렸고 이걸 어떻게 하면 효율적으로 생성할 수 있을지가 아직 잘 떠오르지 않습니다!
-> 이 부분은 사실 css 네이밍 컨벤션의 영역이랑도 맞닿아있어서 이 부분을 찾아보시면 좋을 것 같습니다 : )
@@ -0,0 +1,307 @@ | |||
<!DOCTYPE html> |
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 name convention을 맞춰보아도 좋을 것 같습니다 : )
주로 협업할 땐 무조건 컨벤션을 맞춰서 작성하게 될텐데, HTML,CSS.javascript 조합에서는 BEM 방법론을 가장 흔히 사용하는 것 같아요
https://tech.elysia.land/%EB%84%A4%EC%9D%B4%EB%B0%8D-%EC%BB%A8%EB%B2%A4%EC%85%98-bem-b291ba7bff01
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 utility 클래스 형식도 고려해볼 수 있습니다 : )
src/write.js
Outdated
let tagArr = []; | ||
|
||
function isExist(value) { | ||
for (let i = 0; i < tagArr.length; i++) { | ||
if (value == tagArr[i]) return true; | ||
} | ||
return false; | ||
} |
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.
좋은 방식이지만 또 새로운 방식을 제안해보자면
let tagArr = new Set();
의 방식을 통해 Set자료형을 이용하면 처음부터 중복을 피할 수도 있습니다!
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.
@Nahee-Park 혹시 요 커밋내역 한번만 확인해주실 수 있나요..! 이렇게 수정하는게 맞는건지 확신이 안 들어서요🥲
src/index.js
Outdated
function handleMouseenter(event) { | ||
let selected = event.currentTarget; | ||
selected.style.backgroundColor = "lightgrey"; | ||
} | ||
|
||
function handleMouseleave(event) { | ||
let selected = event.currentTarget; | ||
selected.style.backgroundColor = "whitesmoke"; | ||
} |
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 handleMouseenter(event) { | |
let selected = event.currentTarget; | |
selected.style.backgroundColor = "lightgrey"; | |
} | |
function handleMouseleave(event) { | |
let selected = event.currentTarget; | |
selected.style.backgroundColor = "whitesmoke"; | |
} | |
function handleMouseEnterLeave(event, isEntering) { | |
let selected = event.currentTarget; | |
selected.classList.toggle("hovered", isEntering); // 클래스로 스타일 변경 | |
} | |
dropDownContents.forEach((content) => { | |
content.addEventListener("mouseenter", (e) => handleMouseEnterLeave(e, true)); | |
content.addEventListener("mouseleave", (e) => handleMouseEnterLeave(e, false)); | |
content.addEventListener("click", handleContentClick); | |
}); |
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.
@Nahee-Park 이렇게 수정하려고 했는데 CSS 적용이 잘 안되네요 ㅠㅠ isEntering이 될 때마다 해당 html 태그 class에 hovered 가 정상적으로 추가되는 것도 확인했는데... 왜 적용이 안될까요?
해당 커밋 내역입니다! => #
나희님 리뷰 받고 수정 Co-authored-by: devstone <[email protected]>
✨ 구현 기능 명세
<DropDown 구현>
<Modal 창 구현>
<태그 추가 및 삭제>
🎁 PR Point
Javascript를 조금 더 공부해야될 것 같습니다..
😭 어려웠던 점
😎 구현 결과물
2023-11-22.212533.mp4