Add Poster image from Shop page

This commit is contained in:
2021-11-03 22:01:38 +01:00
parent 230a5568e8
commit 439cdaee98
2 changed files with 22 additions and 5 deletions

View File

@@ -1,15 +1,29 @@
<script lang="ts"> <script lang="ts">
import Button from '$components/atoms/Button.svelte' import Button from '$components/atoms/Button.svelte'
import Image from '$components/atoms/Image.svelte'
export let slug: string export let location: { name: string, slug: string }
export let image: any
</script> </script>
<div class="poster"> <div class="poster">
<img src="https://picsum.photos/326/475" width={326} height={475} alt="blob"> {#if image}
<Image
id={image.id}
sizeKey="product"
sizes={{
small: { width: 326 },
medium: { width: 326 },
large: { width: 326 },
}}
ratio={1.5}
alt="Poster of {location.name}"
/>
{/if}
<div class="buttons"> <div class="buttons">
<Button <Button
size="xsmall" size="xsmall"
url="/shop/poster-{slug}" url="/shop/poster-{location.slug}"
text="View" text="View"
/> />
<Button <Button

View File

@@ -71,8 +71,11 @@
<section class="shop-page__posters grid"> <section class="shop-page__posters grid">
<h3>View all of our available posters</h3> <h3>View all of our available posters</h3>
<div class="set"> <div class="set">
{#each posters as { location }} {#each posters as { location, photos_product }}
<Poster slug={location.slug} /> <Poster
location={location}
image={photos_product.length && photos_product[1].directus_files_id}
/>
{/each} {/each}
</div> </div>
<div class="subscribe"> <div class="subscribe">