Update startup.sh, +page.server.ts, FeaturedAdventureCard.svelte, and Navbar.svelte

This commit is contained in:
Sean Morley
2024-04-02 18:04:27 +00:00
parent f86151ee5e
commit 4b2306f812
7 changed files with 143 additions and 7 deletions

View File

@@ -1,11 +1,25 @@
<script lang="ts">
export let data
console.log(data.result);
import AdventureCard from '$lib/components/AdventureCard.svelte';
import FeaturedAdventureCard from '$lib/components/FeaturedAdventureCard.svelte';
import type { Adventure } from '$lib/utils/types.js';
import { addAdventure, getNextId } from '../../services/adventureService.js';
function add(event: CustomEvent<{name: string, location: string}>) {
console.log(event.detail);
let newAdventure:Adventure = {
id: getNextId(),
name: event.detail.name,
location: event.detail.location,
created: ""
}
addAdventure(newAdventure);
}
</script>
<div class="grid xl:grid-cols-3 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1 gap-4 mt-4 content-center auto-cols-auto ml-6 mr-6">
{#each data.result as adventure (adventure.id)}
<AdventureCard id={adventure.id} name={adventure.name} location={adventure.location} created={adventure.created} />
<FeaturedAdventureCard on:add={add} name={adventure.name} location={adventure.location} />
{/each}
</div>