Setup some components
This commit is contained in:
10
src/components/atoms/Button.svelte
Normal file
10
src/components/atoms/Button.svelte
Normal 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}
|
||||
@@ -1,3 +1,14 @@
|
||||
<script lang="ts">
|
||||
export let location
|
||||
export let location: any
|
||||
|
||||
const { name, slug, country, last_updated } = location
|
||||
</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>
|
||||
@@ -1,9 +1,9 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
// Components
|
||||
import Button from '$components/atoms/Button.svelte'
|
||||
import Location from '$components/molecules/Location.svelte'
|
||||
|
||||
export let locations
|
||||
export let locations: any
|
||||
</script>
|
||||
|
||||
<div class="browse">
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
<ul class="browse__continents" id="continents">
|
||||
<li>
|
||||
<Button type="button" text="All" class="button-outline" />
|
||||
<Button tag="button" text="All" class="button-outline" />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="browse__locations" id="locations_list" role="list">
|
||||
{#each locations as location (location.id)}
|
||||
{#each locations as location (location.slug)}
|
||||
<Location
|
||||
location={location}
|
||||
/>
|
||||
|
||||
@@ -24,13 +24,21 @@
|
||||
name
|
||||
slug
|
||||
country {
|
||||
name
|
||||
slug
|
||||
flag {
|
||||
id
|
||||
}
|
||||
}
|
||||
date_updated
|
||||
}
|
||||
|
||||
country {
|
||||
name
|
||||
slug
|
||||
flag {
|
||||
id
|
||||
}
|
||||
}
|
||||
|
||||
continent {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import Locations from '$components/organisms/Locations.svelte'
|
||||
|
||||
const globalData: any = getContext('global')
|
||||
console.log(globalData)
|
||||
</script>
|
||||
|
||||
<Metas
|
||||
|
||||
1
src/routes/location/[country]/[location].svelte
Normal file
1
src/routes/location/[country]/[location].svelte
Normal file
@@ -0,0 +1 @@
|
||||
<h1>Hello location</h1>
|
||||
Reference in New Issue
Block a user