Photo: Add a comma at end only if more than one line
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
const { name, date, location } = photo
|
||||
const { private_hash } = photo.image
|
||||
const imgAlt = `${name}, ${location.region}, ${location.country.name}`
|
||||
const nameSplit = name.split(', ')
|
||||
|
||||
// Photo index
|
||||
const photoIndex = (index < 10 ? '0': '') + index
|
||||
@@ -35,9 +36,11 @@
|
||||
<div class="photo__location wrap">
|
||||
<div class="wrapper">
|
||||
<h2 class="title-location" id="photo-{index + 1}">
|
||||
{#each name.split(', ') as line, i}
|
||||
{#each nameSplit as line, i}
|
||||
<span class="line">
|
||||
<span>{name.split(', ')[i]},</span>
|
||||
<span>
|
||||
{nameSplit[i]}{#if i < nameSplit.length - 1},{/if}
|
||||
</span>
|
||||
</span>
|
||||
{/each}
|
||||
</h2>
|
||||
|
||||
Reference in New Issue
Block a user