-
Notifications
You must be signed in to change notification settings - Fork 4
[투두리스트 만들기] 류승찬 미션 제출합니다. #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
Open
winshine0326
wants to merge
25
commits into
insertcourse24:main
Choose a base branch
from
winshine0326:winshine0326
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2b57d45
feat: practice1 1단계(계산기) 완료
winshine0326 bd9cec3
feat: practice1 2단계(함수로 분리하기) 완료
winshine0326 2b8362d
feat: practice1 3단계(객체 사용해보기) 완료
winshine0326 f815d4d
feat: practice1 4단계(화살표 함수 익히기) 완료
winshine0326 d83a2a0
feat: practice2 미션 완료
winshine0326 9f3d622
feat: todolist container HTML 및 CSS 작업
winshine0326 1fe12f1
chore: ul 태그 추가
winshine0326 de5ffb5
chore: form 태그 삭제
winshine0326 ea18948
style: ul style 추가
winshine0326 8cd8954
feat: 할 일 추가 기능 구현
winshine0326 548a47c
style: li button style 변경
winshine0326 0e7f092
feat: 텍스트 없이 +버튼을 누를 경우 경고창 띄우기
winshine0326 978513a
style: li style 변경
winshine0326 26cde3b
chore: favicon + 제목 수정
winshine0326 5a2635e
style: body background color 변경
winshine0326 2348d58
feat: 목록 클릭 시 줄긋기 + 더블클릭 시 목록에서 삭제
winshine0326 2203816
feat: 버튼 누를 시 밑줄, 한번 더 누르면 밑줄 사라짐+할일 텍스트 클릭 시 목록에서 제거
winshine0326 b180efd
style: 할 일 체크 시 텍스트 색깔 변경
winshine0326 42667b8
feat: 텍스트 더블클릭 시 삭제 -> 내용 수정으로 변경
winshine0326 16fd758
feat: 삭제버튼 추가
winshine0326 15d6f25
fix: 내용 없이 수정완료를 누르면 텍스트가 날라가는 문제 해결
winshine0326 c7828b9
refactor : lang en => ko 변경
winshine0326 22d619e
refactor : if else 구문 삼항연산자로 변경
winshine0326 d361f97
refactor : 쿼리셀렉터 -> getElementById 로 변경
winshine0326 88c58cf
refactor : 네이밍 컨벤션 케밥 표키법으로 표현
winshine0326 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,30 @@ | ||
| // Mission 1 | ||
| let num = { | ||
| a: 0, | ||
| sign: 0, | ||
| b: 0 | ||
| } | ||
|
|
||
| const input = () => { | ||
| num.a = prompt("첫번째 값 입력") | ||
| num.sign = prompt("계산 부호") | ||
| num.b = prompt("두번쨰 값 입력") | ||
|
|
||
| num.a = parseInt(num.a) | ||
| num.b = parseInt(num.b) | ||
| } | ||
|
|
||
| const calc = (a, b, sign) => { | ||
| if (sign == '+') | ||
| alert(a + sign + b + '=' + (a + b)) | ||
| else if (sign == '-') | ||
| alert(a + sign + b + '=' + (a - b)) | ||
| else if (sign == '*') | ||
| alert(a + sign + b + '=' + (a * b)) | ||
| else if (sign == '/') | ||
| alert(a + sign + b + '=' + (a / b)) | ||
| else if (sign == '%') | ||
| alert(a + sign + b + '=' + (a % b)) | ||
| } | ||
|
|
||
| input() | ||
| calc(num.a, num.b, num.sign) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,20 @@ | ||
| // Mission 2 | ||
| // 두 사람의 나이를 입력 받고 비교해주는 코드 | ||
| let person1 | ||
| let person2 | ||
| let result | ||
|
|
||
| function input(){ | ||
| person1 = prompt('첫번째 사람의 나이') | ||
| person2 = prompt('두번째 사람의 나이') | ||
| } | ||
|
|
||
| input() | ||
|
|
||
| result = person1===person2 ? '같다' : ((person1>person2) ? '첫번째가 더 크다' : '두번째가 더 크다' ) //삼항 연산자, Strict Equal 연산자 | ||
| // 두 명의 나이가 같다면 result에 같다, 한 쪽이 크면 큰 쪽을 result에 저장. | ||
|
|
||
| if(!(!!person1) || !(!!person2)) // Double Exclamation Marks 연산자 | ||
| alert('나이가 입력되야 합니다!') // 만약 person1 혹은 person2에 null값이 입력되면 느낌표 두개 연산자로 false로 변환하여 명확히 걸러줌. | ||
| else | ||
| alert(result) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="ko"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>ToDoList</title> | ||
| <link rel="stylesheet" href="style.css"> | ||
| <link rel="icon" href="https://cdn-icons-png.flaticon.com/512/4345/4345037.png"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div id="TodoContainer"> | ||
| <h2>TodoList</h2> | ||
| <input type="text" placeholder="해야할 일 추가하기" id="text-container"> | ||
| <button class="submit-button" onclick="addTodolist()">+</button> | ||
| <ul id="todolist"> | ||
| </ul> | ||
| </div> | ||
| <script type="text/javascript" src="script.js"></script> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| function addTodolist() { | ||
| let swt = true | ||
| let li = document.createElement('li') | ||
| let text = document.createElement('span') | ||
| let btn = document.createElement('button') | ||
| let delbtn = document.createElement('button') | ||
|
|
||
| delbtn.className = 'delbtn' | ||
| delbtn.innerHTML = "삭제" | ||
|
|
||
| li.appendChild(btn) | ||
| li.appendChild(text) | ||
| li.appendChild(delbtn) | ||
|
|
||
| const todo = document.getElementById('text-container') | ||
| if (!todo.value) | ||
| alert("해야할 일을 작성해주세요!") | ||
| else { | ||
| text.innerHTML = todo.value //li안에 들어갈 span 태그 안에 텍스트박스 value 값 넣어주기 | ||
| const todolist = document.getElementById('todolist') | ||
| todolist.appendChild(li) // ul에 li 연결 | ||
| todo.value = '' // 텍스트 박스 비우기 | ||
| } | ||
| console.log(todolist) | ||
|
|
||
| btn.addEventListener('click', () => { | ||
| li.style.textDecoration = swt?"line-through":"none" | ||
| li.style.color = swt?"#a1a1a1":"black" | ||
| btn.style.backgroundColor = swt?"#e37e8e":"white" | ||
| swt = !swt | ||
| }) // 버튼 한번 클릭 시 텍스트에 줄 긋기 | ||
|
|
||
| text.addEventListener('dblclick', () => { | ||
| let newtext = prompt("변경할 내용을 입력해주세요") | ||
| if(!(!!newtext)) | ||
| alert("잘못된 요청입니다!") // 내용이 비워져있으면 수정x | ||
| else | ||
| text.innerHTML = newtext | ||
| }) // 텍스트 더블클릭 시 내용 수정 | ||
|
|
||
| delbtn.addEventListener('click', () => { | ||
| todolist.removeChild(li) | ||
| }) // 딜리트 버튼 누를 시 리스트 삭제 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| body{ | ||
| background-color: #ffe4e9; | ||
| } | ||
|
|
||
| #TodoContainer{ | ||
| background-color: #ffc0cb; | ||
| width:20rem; | ||
| margin:0 auto; | ||
| height: auto; | ||
| text-align: center; | ||
| padding: 2em 0; | ||
| border-radius: 3px; | ||
| } | ||
|
|
||
| #text-container{ | ||
| width:70%; | ||
| height: 2.1em; | ||
| font-weight: 700; | ||
| border:none; | ||
| border-radius: 3px; | ||
| padding-left: 7px; | ||
| } | ||
| input:focus{ | ||
| outline:none; | ||
| } | ||
|
|
||
| h2{ | ||
| margin:0; | ||
| margin-bottom: 5%; | ||
| } | ||
|
|
||
| .submit-button{ | ||
| height: 2rem; | ||
| width: 2rem; | ||
| background-color: #f78d9f; | ||
| border: none; | ||
| border-radius: 3px; | ||
| } | ||
|
|
||
| .submit-button:hover{ | ||
| background-color: #ad606d; | ||
| } | ||
|
|
||
| ul{ | ||
| margin: 20px auto; | ||
| list-style-type: none; | ||
| padding:0 10px; | ||
| width:85%; | ||
| text-align: left; | ||
| } | ||
|
|
||
| li{ | ||
| margin: 8px 0; | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| li>button{ | ||
| background-color: #ffffff; | ||
| width: 1rem; | ||
| height: 1rem; | ||
| border: none; | ||
| border-radius: 2px; | ||
| margin-right: 5px; | ||
| } | ||
| li>button:hover{ | ||
| background-color: #a6a6a6; | ||
| } | ||
|
|
||
| .delbtn{ | ||
| float:right; | ||
| background-color: rgb(255, 112, 112); | ||
| height: auto; | ||
| width: auto; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
주석 남기며 공부하는 방법 너무 좋은 것 같습니다!!