1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-28 09:19:37 +02:00

Refactor AdventureCard component and remove FeaturedAdventureCard

This commit is contained in:
Sean Morley 2024-04-02 21:33:41 +00:00
parent cde83b35d6
commit f0894a964f
4 changed files with 31 additions and 27 deletions

View file

@ -4,6 +4,8 @@
import calendar from "$lib/assets/calendar.svg";
const dispatch = createEventDispatcher();
export let type:String;
export let name:String;
export let location:String;
export let created:string;
@ -15,13 +17,22 @@
function edit() {
dispatch('edit', id)
}
function add() {
dispatch('add', {name, location});
}
</script>
{#if type === 'mylog'}
<div class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-neutral shadow-xl overflow-hidden">
<div class="card-body">
<h2 class="card-title overflow-ellipsis">{name}</h2>
{#if location !== ""}
<p><img src={locationDot} class="inline-block -mt-1 mr-1" alt="Logo" />{location}</p>
{/if}
{#if created !== ""}
<p><img src={calendar} class="inline-block -mt-1 mr-1" alt="Logo" />{created}</p>
{/if}
<div class="card-actions justify-end">
<button class="btn btn-primary" on:click={edit}>Edit</button>
<button class="btn btn-secondary" on:click={remove}>Remove</button>
@ -29,3 +40,20 @@
</div>
</div>
{/if}
{#if type === 'featured'}
<div class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-neutral shadow-xl overflow-hidden">
<div class="card-body">
<h2 class="card-title overflow-ellipsis">{name}</h2>
{#if location!=""}
<p><img src={locationDot} class="inline-block -mt-1 mr-1" alt="Logo" />{location}</p>
{/if}
<div class="card-actions justify-end">
<button class="btn btn-primary" on:click={add}>Add</button>
</div>
</div>
</div>
{/if}