Skip to content

Commit 6358593

Browse files
committed
refactor: use data attribute on to-do checkbox
1 parent 806e809 commit 6358593

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/TodoItem.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ defineProps<{ todo: TodoData; removeFn: (id: string) => void; toggleFn: (id: str
55
</script>
66

77
<template>
8-
<div class="flex items-center justify-between gap-5 p-2 text-xl rounded-lg group animate-fade-up"
9-
:class="!todo.complete && 'bg-neutral-200/30'">
8+
<div :data-is-completed="todo.complete"
9+
class="flex items-center justify-between gap-5 duration-300 p-2 text-xl rounded-lg group animate-fade-up data-[is-completed='false']:bg-neutral-200/30">
1010
<div class="flex items-center w-full gap-5 overflow-hidden">
1111
<input type="checkbox" title="Mark to-do as completed" :checked="todo.complete" @click="toggleFn(todo.id)"
12-
class="p-3 bg-transparent border rounded cursor-pointer border-neutral-700 text-vue-light focus:outline-none focus:ring-0" />
12+
class="p-3 duration-300 bg-transparent border rounded cursor-pointer border-neutral-700 text-vue-light focus:outline-none focus:ring-0" />
1313
<span :class="todo.complete && 'text-neutral-500 line-through'"
1414
class="overflow-hidden text-ellipsis whitespace-nowrap" :title="todo.name">{{ todo.name }}</span>
1515
</div>

0 commit comments

Comments
 (0)