Add link to photo on Homepage collage
This commit is contained in:
@@ -3,17 +3,31 @@
|
|||||||
|
|
||||||
export let id: string
|
export let id: string
|
||||||
export let alt: string
|
export let alt: string
|
||||||
|
export let url: string = undefined
|
||||||
|
|
||||||
|
const sizes = {
|
||||||
|
small: { width: 224 },
|
||||||
|
medium: { width: 464 },
|
||||||
|
large: { width: 864 },
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="photo-card">
|
<div class="photo-card">
|
||||||
<Image
|
{#if url}
|
||||||
id={id}
|
<a href={url}>
|
||||||
sizes={{
|
<Image
|
||||||
small: { width: 224 },
|
id={id}
|
||||||
medium: { width: 464 },
|
{sizes}
|
||||||
large: { width: 864 },
|
ratio={1.5}
|
||||||
}}
|
alt={alt}
|
||||||
ratio={1.5}
|
/>
|
||||||
alt={alt}
|
</a>
|
||||||
/>
|
{:else}
|
||||||
|
<Image
|
||||||
|
id={id}
|
||||||
|
{sizes}
|
||||||
|
ratio={1.5}
|
||||||
|
alt={alt}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -40,8 +40,12 @@
|
|||||||
|
|
||||||
<section class="homepage__photos">
|
<section class="homepage__photos">
|
||||||
<div class="homepage__collage">
|
<div class="homepage__collage">
|
||||||
{#each photos as { image: { id, title } }}
|
{#each photos as { slug, location: { slug: locationSlug, country }, image: { id, title } }}
|
||||||
<PhotoCard id={id} alt={title} />
|
<PhotoCard
|
||||||
|
id={id}
|
||||||
|
alt={title}
|
||||||
|
url="/{country.slug}/{locationSlug}/{slug}"
|
||||||
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -96,6 +100,11 @@
|
|||||||
const res = await fetchAPI(`
|
const res = await fetchAPI(`
|
||||||
query {
|
query {
|
||||||
photo (limit: 11, sort: ["-date_created"]) {
|
photo (limit: 11, sort: ["-date_created"]) {
|
||||||
|
slug
|
||||||
|
location {
|
||||||
|
slug
|
||||||
|
country { slug }
|
||||||
|
}
|
||||||
image {
|
image {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
|||||||
Reference in New Issue
Block a user