mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-28 09:19:37 +02:00
Update AdventureCard component to include regionId and visited properties
This commit is contained in:
parent
b2210dc7c9
commit
00d9270546
4 changed files with 161 additions and 5 deletions
|
@ -10,6 +10,8 @@
|
|||
export let location: String | undefined = undefined;
|
||||
export let created: String | undefined = undefined;
|
||||
export let id: Number | undefined = undefined;
|
||||
export let regionId: String | undefined = undefined;
|
||||
export let visited: Boolean | undefined = undefined;
|
||||
|
||||
function remove() {
|
||||
dispatch("remove", id);
|
||||
|
@ -20,6 +22,14 @@
|
|||
function add() {
|
||||
dispatch("add", { name, location });
|
||||
}
|
||||
function markVisited() {
|
||||
dispatch("markVisited", regionId);
|
||||
visited = true;
|
||||
}
|
||||
function removeVisit() {
|
||||
dispatch("removeVisit", regionId);
|
||||
visited = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if type === "mylog"}
|
||||
|
@ -110,8 +120,16 @@
|
|||
>
|
||||
<div class="card-body">
|
||||
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
||||
<p>{regionId}</p>
|
||||
<div class="card-actions justify-end">
|
||||
<button class="btn btn-primary">Mark Visited</button>
|
||||
{#if !visited}
|
||||
<button class="btn btn-primary" on:click={markVisited}
|
||||
>Mark Visited</button
|
||||
>
|
||||
{/if}
|
||||
{#if visited}
|
||||
<button class="btn btn-warning" on:click={removeVisit}>Remove</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue