-
Notifications
You must be signed in to change notification settings - Fork 11
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
[1주차] 한서정 미션 제출합니다. #9
base: main
Are you sure you want to change the base?
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.
코드가 정말 깔끔하게 작성되어 있고 주석이 세세한 부분까지 잘 달려 있어 코드를 이해하기 정말 편했습니다!! 함수 분리도 그렇고 전반적으로 코드가 구조화가 잘 되어 있고, 디자인적인 면도 많이 신경쓰신 게 느껴졌습니다. 코드리뷰하면서 많이 배워갑니다! 과제하시느라 수고 많으셨어요.😸👍
@@ -0,0 +1,138 @@ | |||
/* 투두 모양 json 설계 | |||
|
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.
데이터를 모듈화해서 사용하시는 방식이 깔끔하고 가독성이 좋아서 인상적이에요!! 코드 작성할 때 모듈화에 대해서는 생각해 보지 못했는데 저 또한 참고해서 고민해 봐야 할 것 같습니다. 😊👍
<div id="header-div"></div> | ||
</header> | ||
<div class="app-container"> | ||
<section class="todo-input-section"> |
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.
저는 한 번도 section 태그는 활용해 본 적이 없었는데 확실하게 구분되어 가독성이 올라가니 편한 것 같아요!
word-break: break-word; /* 긴 단어가 있으면 줄바꿈 */ | ||
overflow-wrap: break-word; /* 박스 안에서 줄바꿈 */ |
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.
처음에 배포 링크 들어가보고 너무 잘 만드셔서 놀랐어요! css 파일에까지 주석이 달려있어서 이해하기 너무 편했고 함수명도 잘 지어주셔서 가독성이 좋았습니다,,
다만 요일별 todo 개수가 필수요건에 포함되어있어서 저도 급하게 추가했었는데 요일별 todo 개수도 확인할 수 있으면 좋았을 것 같습니다!
과제 하시느라 수고하셨습니다~!
// 삭제 버튼 | ||
const deleteSpan = document.createElement("span"); | ||
deleteSpan.textContent = "삭제"; | ||
deleteSpan.classList.add("delete-btn"); | ||
deleteSpan.addEventListener("click", deleteTodo); |
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.
버튼은 태그를 사용하여 cursor: pointer와 같은 기본 css도 챙기고 접근성도 높이면 좋을 것 같습니다!
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.
앗 넵 감사합니다! 수정해놓았습니다:)
padding: 10px; | ||
gap: 4px; | ||
border-radius: 8px; | ||
font-size: 1rem; |
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.
font-size로 px와 rem을 섞어 사용하시는 이유가 궁금합니다!
|
||
.app-container { | ||
width: 100%; | ||
padding: 80px 0 24px; |
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.
script.js
Outdated
console.log(existingTag); | ||
if (existingTag) { | ||
// 기존 태그에 할 일이 있는 경우 → 해당 태그의 todos 배열에 추가 | ||
existingTag.todos.push(newTodo); | ||
} else return alert("에러"); |
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.
이런 에러가 있었군요.. 감사합니다 수정했서요!
} else return alert("에러"); | ||
|
||
//세션에 저장 | ||
sessionStorage.setItem("todos", JSON.stringify(todos)); |
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.
localStorage 대신 페이지 세션이 끝날 때 데이터가 제거되는 sessionStorage를 사용하신 이유가 따로 있으신가요??
const color = [ | ||
"#E3EAF5", | ||
"#C6D3EE", | ||
"#BCC8E6", | ||
"#E5DFF5", | ||
"#D7E3F3", | ||
"#CFE0F1", | ||
"#D9D0F2", | ||
"#E1E7F8", | ||
"#D0D7F1", | ||
"#E8E3FA", |
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 tagList = document.getElementById("todo-list-container"); | ||
|
||
// 태그 컨테이너 생성 공통 함수 | ||
// 처음에 innerHtml 사용했는데 찾아보니 보안상 위험하다고 해서 다시 만듬 |
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.
헉 저는 그냥 innerHtml 사용했는데 꼼꼼하시군요,,
todoText.classList.add("todo-text"); | ||
|
||
//아랫줄 | ||
const dateDiv = document.createElement("div"); |
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.
<div>
말고 <date>
태그 사용하면 더 좋을 것 같습니다!
<footer> | ||
<p>© 한서정 세오스 1주차 과제</p> | ||
</footer> |
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주차 과제
느낀점
Key Questions
1. DOM은 무엇인가요?
내 코드에서 DOM을 활용한 예시
document.getElementById("add-tag")
를 사용해서<select id="add-tag"></select>
요소를 가져옴.2. 이벤트 흐름 제어(버블링 & 캡처링)이 무엇인가요?
버블링(Bubbling)
<button>
을 클릭하면button → div → body
순서로 이벤트가 전달된다.#add-todo
버튼을 클릭하면addTodo()
함수가 실행된다.#todo-list-container
에도click
이벤트가 등록되어 있다면, 버튼을 클릭한 후에도 이벤트가 부모 요소까지 전달될 수 있다.캡처링(Capturing)
addEventListener
의useCapture
옵션을true
로 설정하면 캡처링이 활성화된다.3. 클로저와 스코프가 무엇인가요?
스코프(Scope)
{}
내부에서만 접근 가능)**를 가짐text
변수는addTodo()
함수 내부에서 선언되었기 때문에 함수 외부에서는 접근할 수 없음클로저(Closure)
createTagManager()
함수가 실행될 때tagCount
변수가 생성되지만, 내부 함수(addTag()
)가 계속 접근할 수 있다.정리
📌 정리
그 외
getElementById()
를 사용해서 선택getElementsByClassName()
또는querySelectorAll()
로 선택 가능