src/routes/Task.svelte (view raw)
1<script lang="ts">
2 import { db } from '$lib/db';
3
4 let { task }: { task: Task } = $props();
5
6 const onUpdateContent = (e: InputEvent) => {
7 const element = e.target as HTMLElement;
8 db.tasks.update(task.id, { content: element.innerText });
9 };
10</script>
11
12<div class="flex items-center justify-between gap-2">
13 <div class="flex items-center gap-2">
14 <input type="checkbox" class="checkbox checkbox-primary checkbox-sm" checked={task.done} />
15 <div contenteditable oninput={onUpdateContent}>{task.content}</div>
16 </div>
17 <input type="date" value={task.dueDate} />
18</div>