-
Notifications
You must be signed in to change notification settings - Fork 4
[mission002] TODOS 시스템에 비동기/온오프라인을 고려하여 업데이트하기 #14
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
StellaKim1230
wants to merge
12
commits into
master
Choose a base branch
from
mission002/kimjieun
base: master
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
12 commits
Select commit
Hold shift + click to select a range
9d8edc6
create folder directory with mission002
702d964
add todoinput api.
StellaKim1230 aef0908
tododata fetch api 연결 작업중.
bdaeac8
함수표현식, 선언식 수정 작업중.
a7631bc
이슈 반영
e5242fe
이슈 반영
f314346
이슈 반영
c24899b
이슈 반영
StellaKim1230 278526a
이슈 반영
StellaKim1230 d20f675
fetch 해오는 부분 try~catch 적용.
StellaKim1230 4db3d6e
코드리뷰 반영.
StellaKim1230 5999841
mission002 리뷰 반영.
StellaKim1230 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { ACTIVE, COMPLETED, ALLSELECTED } from '../utils/constants.js' | ||
|
|
||
| export default class TodoCheck { | ||
| constructor({ $selector }) { | ||
| this.$selector = $selector | ||
|
|
||
| this.init() | ||
| } | ||
|
|
||
| init = () => { | ||
| this.$selector.addEventListener('click', (e) => { | ||
| switch (e.target.className) { | ||
| case ACTIVE: | ||
| return this.onTodoCheck(ACTIVE) | ||
| case COMPLETED: | ||
| return this.onTodoCheck(COMPLETED) | ||
| default: | ||
| return this.onTodoCheck(ALLSELECTED) | ||
| } | ||
| }) | ||
| } | ||
| } |
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,13 @@ | ||
| export default class TodoCount { | ||
| constructor({ $selector }) { | ||
| this.$selector = $selector | ||
| } | ||
|
|
||
| createHtmlString = (data) => { | ||
| return `총 <strong>${data.length}</strong> 개` | ||
| } | ||
|
|
||
| createTodoCount = (data) => { | ||
| this.$selector.innerHTML = this.createHtmlString(data) | ||
| } | ||
| } |
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,13 @@ | ||
| export default class TodoInput { | ||
| constructor({ $selector }) { | ||
| this.$selector = $selector | ||
|
|
||
| this.init() | ||
| } | ||
|
|
||
| init() { | ||
| this.$selector.addEventListener('keydown', (e) => { | ||
| this.onKeyDown(e) | ||
| }) | ||
| } | ||
| } |
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,33 @@ | ||
| import { DESTROY, TOGGLE } from '../utils/constants.js' | ||
|
|
||
| export default class TodoList { | ||
| constructor({ $selector }) { | ||
| this.$selector = $selector | ||
| this.init() | ||
| } | ||
|
|
||
| init = () => { | ||
| this.$selector.addEventListener('click', (e) => { | ||
| if (e.target.className === DESTROY) return this.onDeleteTodo(e.target.parentNode.dataset.idx) | ||
| if (e.target.className === TOGGLE) return this.onToggleTodo(e.target.parentNode.dataset.idx) | ||
| }) | ||
| } | ||
|
|
||
| createLiClassName = (isCompleted) => isCompleted ? 'completed' : 'view' | ||
|
|
||
| createTodoListHtmlString = ({ content, isCompleted, _id }) => { | ||
| return `<li class=${this.createLiClassName(isCompleted)}> | ||
| <div data-idx=${_id} class="view"> | ||
| <input class="toggle" type="checkbox" ${isCompleted === true && 'checked'}> | ||
| <label class="label">${content}</label> | ||
| <button class="destroy"></button> | ||
| </div> | ||
| <input class="edit" value="${content}"> | ||
| </li>` | ||
| } | ||
|
|
||
| render = (data) => { | ||
| const $todoList = document.querySelector('#todo-list') | ||
| $todoList.innerHTML = data.map(this.createTodoListHtmlString).join('') | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
isCompoled 가 false 면
<input class="toggle" type="checkbox" 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.
ㅎㅎ 테스트해보겠습니다! ㅎ
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.
false 안남는것으로 확인했습니다 ㅎㅎ