Add city to House info if existing
This commit is contained in:
@@ -119,8 +119,8 @@
|
|||||||
<div class="viewer-photo__info">
|
<div class="viewer-photo__info">
|
||||||
<h1 class="title-medium">{currentPhoto.title}</h1>
|
<h1 class="title-medium">{currentPhoto.title}</h1>
|
||||||
|
|
||||||
<div class="detail text-date">
|
<div class="detail text-info">
|
||||||
<Icon class="icon" icon="map-pin" label="Map pin" /><span>{location.name}, {location.country.name}</span> <span class="sep">·</span> <time datetime={dayjs(currentPhoto.date_taken).format('YYYY-MM-DD')}>{dayjs(currentPhoto.date_taken).format('MMMM, Do YYYY')}</time>
|
<Icon class="icon" icon="map-pin" label="Map pin" /> <span>{location.name}, {location.country.name}</span> <span class="sep">·</span> <time datetime={dayjs(currentPhoto.date_taken).format('YYYY-MM-DD')}>{dayjs(currentPhoto.date_taken).format('MMMM, Do YYYY')}</time>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
|
import { getAssetUrlKey } from '$utils/helpers'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import advancedFormat from 'dayjs/plugin/advancedFormat.js'
|
import advancedFormat from 'dayjs/plugin/advancedFormat.js'
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime.js'
|
import relativeTime from 'dayjs/plugin/relativeTime.js'
|
||||||
import { getAssetUrlKey } from '$utils/helpers'
|
|
||||||
// Components
|
// Components
|
||||||
import Metas from '$components/Metas.svelte'
|
import Metas from '$components/Metas.svelte'
|
||||||
|
import Icon from '$components/atoms/Icon.svelte'
|
||||||
import Button from '$components/atoms/Button.svelte'
|
import Button from '$components/atoms/Button.svelte'
|
||||||
import IconEarth from '$components/atoms/IconEarth.svelte'
|
import IconEarth from '$components/atoms/IconEarth.svelte'
|
||||||
import Image from '$components/atoms/Image.svelte'
|
import Image from '$components/atoms/Image.svelte'
|
||||||
@@ -20,10 +21,10 @@
|
|||||||
dayjs.extend(relativeTime)
|
dayjs.extend(relativeTime)
|
||||||
|
|
||||||
const { params } = $page
|
const { params } = $page
|
||||||
let descriptionEl: HTMLElement
|
|
||||||
let currentPage: number = 1
|
let currentPage: number = 1
|
||||||
let ended: boolean
|
let ended: boolean
|
||||||
let currentPhotosAmount: number
|
let currentPhotosAmount: number
|
||||||
|
|
||||||
$: latestPhoto = photos[0]
|
$: latestPhoto = photos[0]
|
||||||
$: currentPhotosAmount = photos.length
|
$: currentPhotosAmount = photos.length
|
||||||
$: ended = currentPhotosAmount === totalPhotos
|
$: ended = currentPhotosAmount === totalPhotos
|
||||||
@@ -66,6 +67,7 @@
|
|||||||
) {
|
) {
|
||||||
title
|
title
|
||||||
slug
|
slug
|
||||||
|
city
|
||||||
image {
|
image {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
@@ -111,7 +113,7 @@
|
|||||||
</strong>
|
</strong>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="location-page__description grid" bind:this={descriptionEl}>
|
<div class="location-page__description grid">
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<div class="text-medium">
|
<div class="text-medium">
|
||||||
Houses of {location.name} {location.description}
|
Houses of {location.name} {location.description}
|
||||||
@@ -155,17 +157,18 @@
|
|||||||
|
|
||||||
{#if photos.length}
|
{#if photos.length}
|
||||||
<section class="location-page__houses grid">
|
<section class="location-page__houses grid">
|
||||||
{#each photos as { title, image: { id, title: alt }, slug, date_taken }, index}
|
{#each photos as { title, image: { id, title: alt }, slug, city, date_taken }, index}
|
||||||
<div class="house grid">
|
<div class="house grid">
|
||||||
<div class="house__info">
|
<div class="house__info">
|
||||||
<a href="/{params.country}/{params.location}/{slug}">
|
|
||||||
<h2 class="title-image">
|
<h2 class="title-image">
|
||||||
{title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
<time class="text-date" datetime={dayjs(date_taken).format('YYYY-MM-DD')}>
|
<p class="info text-info">
|
||||||
|
{#if city}<Icon class="icon" icon="map-pin" label="Map pin" /> {city} <span class="sep">·</span>{/if}
|
||||||
|
<time datetime={dayjs(date_taken).format('YYYY-MM-DD')}>
|
||||||
{dayjs(date_taken).format('MMMM, Do YYYY')}
|
{dayjs(date_taken).format('MMMM, Do YYYY')}
|
||||||
</time>
|
</time>
|
||||||
</a>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<figure class="house__photo">
|
<figure class="house__photo">
|
||||||
<a href="/{params.country}/{params.location}/{slug}">
|
<a href="/{params.country}/{params.location}/{slug}">
|
||||||
@@ -263,6 +266,7 @@
|
|||||||
) {
|
) {
|
||||||
title
|
title
|
||||||
slug
|
slug
|
||||||
|
city
|
||||||
image {
|
image {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
|||||||
@@ -108,8 +108,8 @@
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Photo date
|
// Information
|
||||||
.text-date {
|
.text-info {
|
||||||
font-size: rem(14px);
|
font-size: rem(14px);
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,13 @@
|
|||||||
|
|
||||||
// Information
|
// Information
|
||||||
&__info {
|
&__info {
|
||||||
grid-column: 2 / span var(--columns);
|
grid-column: 1 / span var(--columns);
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
max-width: min(540px, 85vw);
|
|
||||||
|
|
||||||
|
@include bp (mob-lg) {
|
||||||
|
max-width: min(540px, 85vw);
|
||||||
|
}
|
||||||
@include bp (sm) {
|
@include bp (sm) {
|
||||||
grid-column: 4 / span 14;
|
grid-column: 4 / span 14;
|
||||||
margin-bottom: 56px;
|
margin-bottom: 56px;
|
||||||
@@ -25,14 +27,28 @@
|
|||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
time {
|
.info {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
color: $color-lightgray;
|
color: $color-lightgray;
|
||||||
|
line-height: 1.5;
|
||||||
|
|
||||||
@include bp (sm) {
|
@include bp (sm) {
|
||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
svg {
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
margin-right: 0.4em;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
.sep {
|
||||||
|
margin: 0 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user