Photo: Add a comma at end only if more than one line
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-06-02 15:11:05 +02:00
parent fe5a8e7746
commit 56d9caa86b
2 changed files with 8 additions and 4 deletions

View File

@@ -18,6 +18,7 @@
const { name, date, location } = photo const { name, date, location } = photo
const { private_hash } = photo.image const { private_hash } = photo.image
const imgAlt = `${name}, ${location.region}, ${location.country.name}` const imgAlt = `${name}, ${location.region}, ${location.country.name}`
const nameSplit = name.split(', ')
// Photo index // Photo index
const photoIndex = (index < 10 ? '0': '') + index const photoIndex = (index < 10 ? '0': '') + index
@@ -35,9 +36,11 @@
<div class="photo__location wrap"> <div class="photo__location wrap">
<div class="wrapper"> <div class="wrapper">
<h2 class="title-location" id="photo-{index + 1}"> <h2 class="title-location" id="photo-{index + 1}">
{#each name.split(', ') as line, i} {#each nameSplit as line, i}
<span class="line"> <span class="line">
<span>{name.split(', ')[i]},</span> <span>
{nameSplit[i]}{#if i < nameSplit.length - 1},{/if}
</span>
</span> </span>
{/each} {/each}
</h2> </h2>

View File

@@ -1,5 +1,4 @@
.photo { .photo {
/* /*
** Location ** Location
*/ */
@@ -13,6 +12,7 @@
margin-bottom: 56px; margin-bottom: 56px;
} }
// Street name
h2 { h2 {
text-align: left; text-align: left;
@@ -22,7 +22,8 @@
} }
.line { .line {
overflow: hidden; overflow: hidden;
padding-bottom: 3px; margin: -12px 0 -16px;
padding: 12px 0;
display: block; display: block;
span { span {