[wip] Add Image component
This commit is contained in:
23
src/components/atoms/Image.svelte
Normal file
23
src/components/atoms/Image.svelte
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export let id: string
|
||||||
|
export let alt: string
|
||||||
|
export let width: number
|
||||||
|
export let height: number
|
||||||
|
export let quality: number = 80
|
||||||
|
export let sizes: any = {}
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
// - quality
|
||||||
|
// - sizes
|
||||||
|
// -- width
|
||||||
|
// -- height
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<picture class={$$props.class}>
|
||||||
|
<img
|
||||||
|
src="{import.meta.env.VITE_API_URL_DEV}/assets/{id}"
|
||||||
|
width={width}
|
||||||
|
height={height}
|
||||||
|
alt={alt}
|
||||||
|
/>
|
||||||
|
</picture>
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
// Components
|
||||||
|
import Image from '$components/atoms/Image.svelte'
|
||||||
|
|
||||||
export let location: any
|
export let location: any
|
||||||
|
|
||||||
const { name, slug, country, last_updated } = location
|
const { name, slug, country, last_updated } = location
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="location" role="listitem">
|
<div class="location" role="listitem">
|
||||||
<a href="/location/{country.slug}/{slug}" rel="prefetch" sveltekit-noscroll>
|
<a href="/{country.slug}/{slug}" rel="prefetch" sveltekit-noscroll>
|
||||||
<img src="//api.housesof.localhost:8055/assets/{country.flag.id}" alt="Flag of {country.name}">
|
<Image id={country.flag.id} alt="Flag of {country.name}" width={32} height={32} />
|
||||||
<h3 class="location__name">
|
<h3 class="location__name">
|
||||||
{name}
|
{name}
|
||||||
</h3>
|
</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user