-
Notifications
You must be signed in to change notification settings - Fork 1
Initial commit #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
base: master
Are you sure you want to change the base?
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,21 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <link rel="stylesheet" href="style.css"> | ||
| <title>To Do List</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <h1>To Do List</h1> | ||
| <div class="container"> | ||
| <input id="inputField" type="text"> | ||
| <button id="addToDo"> + </button> | ||
| <div class="to-dos" id="toDoList"> </div> | ||
| </div> | ||
| <script src="main.js"> </script> | ||
|
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. script는 body에 맨 마지막에만 삽입할 수 있을까요? |
||
| </body> | ||
|
|
||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| let inputBox = document.getElementById('inputField') | ||
| let addToDo = document.getElementById('addToDo') | ||
| let toDoList = document.getElementById('toDoList') | ||
|
|
||
| addToDo.addEventListener('click', function(){ | ||
| var list = document.createElement('li'); | ||
| if (!inputBox.value) | ||
| alert('내용을 입력하세요!'); | ||
| else | ||
|
Comment on lines
+7
to
+9
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(!inputBox.value) return alert('내용을 입력하세요!); 로 사용하면 아래 else는 필요없어지겠네요! |
||
| { | ||
| list.innerText = inputBox.value; | ||
| toDoList.appendChild(list); | ||
| inputBox.value= ""; | ||
| } | ||
|
|
||
| list.addEventListener('click', function(){ | ||
| list.style.textDecoration = "line-through"; | ||
| }) | ||
|
Comment on lines
+16
to
+18
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. 만약 이미 |
||
| list.addEventListener('dblclick', function(){ | ||
| toDoList.removeChild(list); | ||
| }) | ||
|
Comment on lines
+19
to
+21
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. 사용자는 더블클릭으로 투두리스트가 삭제된다는 것을 어떻게 알 수 있을까요? |
||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| html, body { | ||
| width: 50%; | ||
| margin: 0 auto; | ||
| font-family: Arial, Helvetica, sans-serif; | ||
| } | ||
|
|
||
| .container { | ||
| width: 360px; | ||
| } | ||
|
Comment on lines
+7
to
+9
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. 어떤 기기에서나 보기 좋은 width를 설정하려면 어떻게 해야할 지 고민해보셔도 좋을 것 같아요! |
||
|
|
||
| #inputFiled { | ||
| width: 300px; | ||
| height: 46px; | ||
| border: 1px solid black; | ||
| outline: none; | ||
| font-size: 25px; | ||
| vertical-align: middle; | ||
| } | ||
|
|
||
| .to-dos { | ||
| margin-top:25px; | ||
| } | ||
|
Comment on lines
+20
to
+22
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. 이 부분은 띄어쓰기가 위에 내용과 다르네요! 이러한 코드들의 정렬을 도와주는 prettier라는 라이브러리가 있습니다. |
||
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.
카멜 케이스(inputFiled, addToDo)와 케밥케이스(to-dos)를 같은 파일에서 사용하시는 것은 코드의 일관성이 깨질 수 있습니다😊
하나의 케이스로 통일하시는 게 좋을 것 같습니다.
보통 classname이나 id는 케밥케이스로 잇는 경우가 많습니다.
이를 통일하기 위해 bem 방법론이나 여러 방법론을 통해 className이나 id 이름을 지을 때 기준을 정해서 협업을 하곤 합니다.
링크 첨부할테니 한번 편하게 읽어보시면 좋을 것 같습니다,
https://whales.tistory.com/33