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">
|
<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>
|
||||||
@@ -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}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
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