Created
July 4, 2019 19:53
-
-
Save sumitkharche/1480dea346d46037ae2795270dcd4254 to your computer and use it in GitHub Desktop.
TodoItem.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { createEventDispatcher } from 'svelte'; | |
export let todo; | |
const dispatch = createEventDispatcher(); | |
function deleteTodo() { | |
dispatch('deleteTodo', { | |
todo: todo | |
}); | |
} | |
function toggleComplete() { | |
dispatch('toggleComplete', { | |
todo: todo | |
}); | |
} | |
</script> | |
<style> | |
.completed { | |
text-decoration: line-through; | |
color: grey; | |
} | |
.text-success { | |
color:green; | |
} | |
.hover-cursor{ | |
cursor: pointer; | |
} | |
</style> | |
<li class="list-group-item"> | |
<span class="hover-cursor {todo.metadata.is_complete ?'text-success':''}" on:click={toggleComplete}> | |
<i class="fa fa-lg {todo.metadata.is_complete ?'fa-check-circle-o':'fa-circle-thin'}"></i> | |
</span> | |
{todo.title} | |
<span class="hover-cursor text-danger pull-right" on:click={deleteTodo}> | |
<i class="fa fa-trash-o fa-lg"></i> | |
</span> | |
</li> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment