File tree Expand file tree Collapse file tree 3 files changed +26
-14
lines changed
Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,19 @@ todoHandler.addEventListener('click', async () => {
3434 try {
3535 const querySnapshot = await getDocs ( collection ( db , 'Todo' ) ) ;
3636 querySnapshot . forEach ( ( doc ) => {
37- const getId = doc . data ( ) . id
38- const getTodo = doc . data ( ) . todo
39- todoList . innerHTML = ``
37+ const getId = doc . data ( ) . id
38+ const getTodo = doc . data ( ) . todo
39+ todoList . innerHTML += `
40+ <li class="todo-item">
41+ <input id= ${ getId } class="inp" value=${ getTodo } type="text" readonly>
42+ <button id= ${ getId } class="btn-edit">Edit</button>
43+ <button id= ${ getId } class="btn-delete">Delete</button>
44+ </li>
45+ `
4046 } ) ;
4147 } catch ( error ) {
42- console . log ( 'The error is in getDocs ::' , error ) ;
43-
48+ console . log ( 'The error is in getDocs ::' , error ) ;
49+
4450 }
4551} )
4652
Original file line number Diff line number Diff line change @@ -19,10 +19,9 @@ <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 >
25- < input type ="text ">
2625</ body >
2726
2827</ html >
Original file line number Diff line number Diff line change 6969
7070 .todo-item {
7171 background : # f1f1f1 ;
72- padding : 12px 15 px ;
72+ padding : 12px 11 px ;
7373 border-radius : 8px ;
7474 display : flex;
75- justify-content : space-between ;
75+ justify-content : space-around ;
7676 align-items : center;
7777 margin-bottom : 10px ;
7878 }
7979
80- .todo-item span {
81- word-break : break-word;
82- color : # 333 ;
83- }
84-
8580 .todo-item .btn-edit ,
8681.todo-item .btn-delete {
8782 padding : 6px 12px ;
109104.todo-item .btn-delete : hover {
110105 background-color : # c82333 ;
111106}
107+ .inp {
108+ width : 65% ;
109+ padding : 3px ;
110+ border-radius : 4px ;
111+ border : 1px solid # ccc ;
112+ background-color : # f1f1f1 ;
113+ border : none;
114+ font-size : 16px ;
115+ }
116+ .inp : focus {
117+ outline : none;
118+ }
You can’t perform that action at this time.
0 commit comments