Setup some components

This commit is contained in:
2021-09-24 11:03:08 +02:00
parent bdbf511a75
commit bb8a67a82a
6 changed files with 37 additions and 8 deletions

View File

@@ -0,0 +1,10 @@
<script lang="ts">
export let text: string
export let tag: string
</script>
{#if tag === 'button'}
<button class="{$$props.class}">
{text}
</button>
{/if}

View File

@@ -1,3 +1,14 @@
<script lang="ts"> <script lang="ts">
export let location export let location: any
const { name, slug, country, last_updated } = location
</script> </script>
<div class="location" role="listitem">
<a href="/location/{country.slug}/{slug}" rel="prefetch" sveltekit-noscroll>
<img src="//api.housesof.localhost:8055/assets/{country.flag.id}" alt="Flag of {country.name}">
<h3 class="location__name">
{name}
</h3>
</a>
</div>

View File

@@ -1,9 +1,9 @@
<script> <script lang="ts">
// Components // Components
import Button from '$components/atoms/Button.svelte' import Button from '$components/atoms/Button.svelte'
import Location from '$components/molecules/Location.svelte' import Location from '$components/molecules/Location.svelte'
export let locations export let locations: any
</script> </script>
<div class="browse"> <div class="browse">
@@ -13,12 +13,12 @@
<ul class="browse__continents" id="continents"> <ul class="browse__continents" id="continents">
<li> <li>
<Button type="button" text="All" class="button-outline" /> <Button tag="button" text="All" class="button-outline" />
</li> </li>
</ul> </ul>
<div class="browse__locations" id="locations_list" role="list"> <div class="browse__locations" id="locations_list" role="list">
{#each locations as location (location.id)} {#each locations as location (location.slug)}
<Location <Location
location={location} location={location}
/> />

View File

@@ -24,13 +24,21 @@
name name
slug slug
country { country {
name
slug
flag {
id id
} }
} }
date_updated
}
country { country {
name name
slug slug
flag {
id
}
} }
continent { continent {

View File

@@ -5,7 +5,6 @@
import Locations from '$components/organisms/Locations.svelte' import Locations from '$components/organisms/Locations.svelte'
const globalData: any = getContext('global') const globalData: any = getContext('global')
console.log(globalData)
</script> </script>
<Metas <Metas

View File

@@ -0,0 +1 @@
<h1>Hello location</h1>