Skip to content

Commit 5c6730e

Browse files
authored
Simplify each block bindings example (#5094)
No need for CSS here, the same effect could be achieved with just a `disabled` binding.
1 parent fc7e99e commit 5c6730e

File tree

1 file changed

+2
-7
lines changed
  • site/content/examples/05-bindings/07-each-block-bindings

1 file changed

+2
-7
lines changed

site/content/examples/05-bindings/07-each-block-bindings/App.svelte

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,10 @@
1616
$: remaining = todos.filter(t => !t.done).length;
1717
</script>
1818

19-
<style>
20-
.done {
21-
opacity: 0.4;
22-
}
23-
</style>
24-
2519
<h1>Todos</h1>
2620

2721
{#each todos as todo}
28-
<div class:done={todo.done}>
22+
<div>
2923
<input
3024
type=checkbox
3125
bind:checked={todo.done}
@@ -34,6 +28,7 @@
3428
<input
3529
placeholder="What needs to be done?"
3630
bind:value={todo.text}
31+
disabled={todo.done}
3732
>
3833
</div>
3934
{/each}

0 commit comments

Comments
 (0)