Rewrite conditional class definition

This commit is contained in:
2022-09-20 11:12:36 +02:00
parent b2a1fbb83b
commit 2568502ab1

View File

@@ -101,8 +101,9 @@
<div class="location__photos"> <div class="location__photos">
{#each location.photos as { image }, index} {#each location.photos as { image }, index}
{#if image} {#if image}
{@const classes = ['location__photo', index === photoIndex ? 'is-visible' : null].join(' ').trim()}
<Image <Image
class={`location__photo ${index === photoIndex ? 'is-visible' : ''}`} class={classes}
id={image.id} id={image.id}
sizeKey="photo-thumbnail" sizeKey="photo-thumbnail"
width={340} height={226} width={340} height={226}