Skip to content

Commit 7dc21e0

Browse files
committed
📝🤔Todo
1 parent cf1c0ab commit 7dc21e0

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

Todo/app.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const todoHandler = document.getElementById('addTodoBtn');
1818
const todoInput = document.getElementById('todoInput');
1919
const todoList = document.getElementById('todoList');
2020
const li = document.createElement('li')
21+
li.className = "todo-item"
2122

2223

2324
todoHandler.addEventListener('click', async () => {
@@ -48,6 +49,7 @@ async function fetching() {
4849
const getId = doc.data().id
4950
const getTodo = doc.data().todo
5051
append(getId, getTodo)
52+
// edit(getId, getTodo)
5153
});
5254
} catch (error) {
5355
console.log('The error is in getDocs ::', error);
@@ -58,14 +60,19 @@ async function fetching() {
5860
function append(id, todo) {
5961
todoInput.value = ""
6062
li.innerHTML += `
61-
<li class="todo-item">
62-
<input id=${id} class="inp" value=${todo} type="text" readonly>
63-
<button id=${id} class="btn-edit">Edit</button>
64-
<button id=${id} class="btn-delete">Delete</button>
65-
</li>
63+
<input id="${id}" class="inp" value=${todo} type="text" readonly>
64+
<button id="${id}" onclick="edit(this)" class="btn-edit">Edit</button>
65+
<button id="${id}" class="btn-delete">Delete</button>
6666
`
6767
todoList.appendChild(li)
6868
console.log(todoList);
69+
70+
}
71+
72+
function edit(button) {
73+
// const getClass = document.querySelector('.btn-edit')
74+
// console.log(getClass);
75+
console.log(button);
6976

7077
}
7178

Todo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h2>🔥 Todo App</h2>
1919
<button id="addTodoBtn">Add</button>
2020
</div>
2121
<ul class="todo-list" id="todoList">
22-
22+
2323
</ul>
2424
</div>
2525
</body>

Todo/style.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,22 @@
6565

6666
.todo-list {
6767
list-style: none;
68+
display: flex;
69+
flex-direction: column;
70+
gap: 10px;
71+
padding: 0;
72+
margin: 0;
6873
}
6974

7075
.todo-item {
7176
background: #f1f1f1;
72-
padding: 12px 11px;
77+
/* padding: 12px 11px; */
78+
gap: 10px;
7379
border-radius: 8px;
74-
display: flex;
75-
justify-content: space-around;
76-
align-items: center;
77-
margin-bottom: 10px;
80+
/* display: flex; */
81+
/* justify-content: space-around; */
82+
/* align-items: center; */
83+
margin: 10px;
7884
}
7985

8086
.todo-item .btn-edit,

0 commit comments

Comments
 (0)