88 lines
2.6 KiB
Svelte
88 lines
2.6 KiB
Svelte
<script lang="ts">
|
|
import { getContext } from 'svelte'
|
|
// Components
|
|
import Metas from '$components/Metas.svelte'
|
|
import Button from '$components/atoms/Button.svelte'
|
|
import BoxCTA from '$components/atoms/BoxCTA.svelte'
|
|
import PhotoCard from '$components/molecules/PhotoCard.svelte'
|
|
import Locations from '$components/organisms/Locations.svelte'
|
|
import Shop from '$components/organisms/Shop.svelte'
|
|
import Newsletter from '$components/organisms/Newsletter.svelte'
|
|
|
|
export let photos: any
|
|
|
|
const { location, count }: any = getContext('global')
|
|
</script>
|
|
|
|
<Metas
|
|
title="Houses Of"
|
|
description=""
|
|
image=""
|
|
/>
|
|
|
|
<main class="homepage">
|
|
<section class="homepage__intro">
|
|
<h1 class="title-huge">Houses</h1>
|
|
<p class="text-medium">Houses Of is a project that showcases houses of character around the world.</p>
|
|
<Button text="Explore locations" url="#">
|
|
<img src="/images/icons/globe.svg" alt="explore globe">
|
|
</Button>
|
|
</section>
|
|
|
|
<section class="homepage__photos">
|
|
<div class="homepage__collage">
|
|
{#each photos as { image: { id, title } }}
|
|
<PhotoCard id={id} alt={title} />
|
|
{/each}
|
|
</div>
|
|
</section>
|
|
|
|
<div class="homepage__ctas">
|
|
<p>Discover <strong>{count.photos} homes<br /></strong> from <strong>{count.locations} cities</strong> of <strong>{count.countries} countries</strong></p>
|
|
<div class="cards">
|
|
<BoxCTA url="#" icon="/images/icons/explore.svg" label="Explore the globe" alt="Globe" />
|
|
<BoxCTA url="#" icon="/images/icons/pin.svg" label="Discover the locations" alt="Paper pin" />
|
|
<BoxCTA url="/shop" icon="/images/icons/bag.svg" label="Shop the prints" alt="Shopping bag" />
|
|
</div>
|
|
</div>
|
|
|
|
<Locations
|
|
locations={location}
|
|
/>
|
|
|
|
<div class="grid-modules">
|
|
<div class="container grid">
|
|
<div class="wrap">
|
|
<Shop />
|
|
<Newsletter />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
|
|
<script context="module" lang="ts">
|
|
import { fetchAPI } from '$utils/api'
|
|
|
|
export async function load ({ page, session, fetch, context }) {
|
|
const res = await fetchAPI(`
|
|
query {
|
|
photo (limit: 11, sort: ["-date_created"]) {
|
|
image {
|
|
id
|
|
title
|
|
}
|
|
}
|
|
}
|
|
`)
|
|
|
|
const { data } = res
|
|
|
|
return {
|
|
props: {
|
|
photos: data.photo,
|
|
}
|
|
}
|
|
}
|
|
</script>
|