Add dynamic photo's index on Location page
This commit is contained in:
@@ -143,7 +143,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="location-page__houses grid">
|
<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 grid">
|
||||||
<div class="house__info">
|
<div class="house__info">
|
||||||
<a href="/{params.country}/{params.location}/{slug}">
|
<a href="/{params.country}/{params.location}/{slug}">
|
||||||
@@ -163,7 +163,9 @@
|
|||||||
height={853}
|
height={853}
|
||||||
class="shadow-photo"
|
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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -42,10 +42,34 @@
|
|||||||
|
|
||||||
// Photo number
|
// Photo number
|
||||||
&__index {
|
&__index {
|
||||||
position: absolute;
|
@include bp (sm) {
|
||||||
right: -250px;
|
position: absolute;
|
||||||
top: 50%;
|
z-index: 1;
|
||||||
transform: translateY(-50%);
|
left: 112.5%;
|
||||||
z-index: 1;
|
width: 400px;
|
||||||
|
top: 50%;
|
||||||
|
text-align: left;
|
||||||
|
transform: translate3d(-50%, -50%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Even photos
|
||||||
|
&:nth-child(even) {
|
||||||
|
.house {
|
||||||
|
&__photo {
|
||||||
|
grid-column-start: 4;
|
||||||
|
}
|
||||||
|
&__info {
|
||||||
|
margin-left: auto;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
&__index {
|
||||||
|
@include bp (sm) {
|
||||||
|
right: auto;
|
||||||
|
left: -12%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,22 +126,6 @@
|
|||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
margin-bottom: 120px;
|
margin-bottom: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:nth-child(even) {
|
|
||||||
.house {
|
|
||||||
&__photo {
|
|
||||||
grid-column-start: 4;
|
|
||||||
}
|
|
||||||
&__info {
|
|
||||||
margin-left: auto;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
&__index {
|
|
||||||
right: auto;
|
|
||||||
left: -250px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next photos section
|
// Next photos section
|
||||||
@@ -190,7 +174,7 @@
|
|||||||
margin: 0 -10px;
|
margin: 0 -10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& > p {
|
p {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 16px auto 0;
|
margin: 16px auto 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user