mirror of
https://github.com/cupcakearmy/svelte-rest-demo.git
synced 2026-04-03 02:15:39 +00:00
client
This commit is contained in:
34
client/src/components/Todo.svelte
Normal file
34
client/src/components/Todo.svelte
Normal file
@@ -0,0 +1,34 @@
|
||||
<script>
|
||||
import Button from './Button.svelte'
|
||||
import Field from './Field.svelte'
|
||||
|
||||
import { remove, update } from '../api'
|
||||
|
||||
export let todo
|
||||
</script>
|
||||
|
||||
<style>
|
||||
li {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 2.5em;
|
||||
}
|
||||
|
||||
span {
|
||||
display: block;
|
||||
width: 1em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<li>
|
||||
<Field bind:value={todo.title} full />
|
||||
<span />
|
||||
<Button
|
||||
on:click={() => (window.location.pathname = '/todo/' + todo._id)}
|
||||
text="View" />
|
||||
<span />
|
||||
<Button on:click={() => update(todo)} text="Update" />
|
||||
<span />
|
||||
<Button on:click={() => remove(todo._id)} text="Delete" />
|
||||
</li>
|
||||
Reference in New Issue
Block a user