Add dynamic photo's index on Location page

This commit is contained in:
2021-10-10 21:40:25 +02:00
parent e44f51c0c4
commit 51dc9650ec
3 changed files with 34 additions and 24 deletions

View File

@@ -143,7 +143,7 @@
</section>
<section class="location-page__houses grid">
{#each photos as { title, image: { id, title: alt }, slug, date_taken }}
{#each photos as { title, image: { id, title: alt }, slug, date_taken }, index}
<div class="house grid">
<div class="house__info">
<a href="/{params.country}/{params.location}/{slug}">
@@ -163,7 +163,9 @@
height={853}
class="shadow-photo"
/>
<span class="house__index title-index">22</span>
<span class="house__index title-index">
{(totalPhotos - index < 10) ? '0' : ''}{totalPhotos - index}
</span>
</a>
</div>
{/each}