Skip to content

Commit 31eb1f5

Browse files
committed
feat(ui): add to-do render animation
1 parent bb08353 commit 31eb1f5

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

src/components/TodoItem.vue

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

77
<template>
8-
<div
9-
class="group flex items-center justify-between gap-5 rounded-lg p-2 text-xl"
10-
:class="!todo.complete && 'bg-neutral-200/30'"
11-
:title="todo.name"
12-
>
8+
<div class="group flex items-center justify-between gap-5 rounded-lg p-2 text-xl animate-fade-up"
9+
:class="!todo.complete && 'bg-neutral-200/30'" :title="todo.name">
1310
<div class="flex w-full items-center gap-5 overflow-hidden">
14-
<input
15-
type="checkbox"
16-
:checked="todo.complete"
17-
@click="toggleFn(todo.id)"
18-
class="cursor-pointer rounded border border-neutral-700 bg-transparent p-3 text-vue-light focus:outline-none focus:ring-0"
19-
/>
20-
<span
21-
:class="todo.complete && 'text-neutral-500 line-through'"
22-
class="overflow-hidden text-ellipsis whitespace-nowrap"
23-
>{{ todo.name }}</span
24-
>
11+
<input type="checkbox" :checked="todo.complete" @click="toggleFn(todo.id)"
12+
class="cursor-pointer rounded border border-neutral-700 bg-transparent p-3 text-vue-light focus:outline-none focus:ring-0" />
13+
<span :class="todo.complete && 'text-neutral-500 line-through'"
14+
class="overflow-hidden text-ellipsis whitespace-nowrap">{{ todo.name }}</span>
2515
</div>
26-
<button
27-
@click="removeFn(todo.id)"
28-
class="text-neutral-500/20 transition-colors hover:text-red-700"
29-
>
16+
<button @click="removeFn(todo.id)" class="text-neutral-500/20 transition-colors hover:text-red-700">
3017
<PhTrash weight="regular" />
3118
</button>
3219
</div>

tailwind.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ module.exports = {
77
colors: {
88
'vue-light': '#42b883',
99
'vue-dark': '#35495e'
10+
},
11+
animation: {
12+
'fade-up': 'fade-up .5s 0s'
13+
},
14+
keyframes: {
15+
'fade-up': {
16+
'0%': {
17+
opacity: '0',
18+
transform:
19+
'translate(var(--tw-translate-x), 50%) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))'
20+
},
21+
'100%': {
22+
opacity: '1',
23+
transform:
24+
'translate(var(--tw-translate-x), 0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))'
25+
}
26+
},
1027
}
1128
}
1229
},

0 commit comments

Comments
 (0)