Skip to content

Commit 86c28ab

Browse files
add style for toggle
1 parent fd895d4 commit 86c28ab

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ <h1>Goal</h1>
209209
const node = document.createElement("li");
210210
const text = document.createTextNode(todo.name);
211211

212-
node.appendChild(text);
212+
node.appendChild(text);
213+
214+
node.style.textDecoration = todo.complete ? "line-through" : "none";
215+
216+
node.addEventListener("click", () => {
217+
store.dispatch(toggleTodoAction(todo.id));
218+
});
213219

214220
document.getElementById("todos").appendChild(node);
215221
}
@@ -220,6 +226,12 @@ <h1>Goal</h1>
220226

221227
node.appendChild(text);
222228

229+
node.style.textDecoration = todo.complete ? "line-through" : "none";
230+
231+
node.addEventListener("click", () => {
232+
store.dispatch(toggleTodoAction(goal.id));
233+
});
234+
223235
document.getElementById("goals").appendChild(node);
224236
}
225237
</script>

0 commit comments

Comments
 (0)