Skip to content

Commit

Permalink
Simplify each block bindings example (sveltejs#5094)
Browse files Browse the repository at this point in the history
No need for CSS here, the same effect could be achieved with just a `disabled` binding.
  • Loading branch information
CyberAP authored Jul 14, 2020
1 parent fc7e99e commit 5c6730e
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@
$: remaining = todos.filter(t => !t.done).length;
</script>

<style>
.done {
opacity: 0.4;
}
</style>

<h1>Todos</h1>

{#each todos as todo}
<div class:done={todo.done}>
<div>
<input
type=checkbox
bind:checked={todo.done}
Expand All @@ -34,6 +28,7 @@
<input
placeholder="What needs to be done?"
bind:value={todo.text}
disabled={todo.done}
>
</div>
{/each}
Expand Down

0 comments on commit 5c6730e

Please sign in to comment.