Change some $$props.class to shorthands

This commit is contained in:
2022-05-31 10:10:41 +02:00
parent 1a0370b0cd
commit 758c3548d7
2 changed files with 3 additions and 9 deletions

View File

@@ -67,7 +67,7 @@
} }
</script> </script>
<picture class={$$props.class ? $$props.class : ''}> <picture class={$$props.class}>
<source <source
type="image/webp" type="image/webp"
srcset={srcSet.webp.join(', ').trim()} srcset={srcSet.webp.join(', ').trim()}

View File

@@ -18,17 +18,11 @@
/** Navigate to specific slide */ /** Navigate to specific slide */
const goToSlide = (index: number = 0) => { const goToSlide = (index: number = 0) => carousel.scrollTo(index)
carousel.scrollTo(index)
}
/** Move and change arrow direction when moving */ /** Move and change arrow direction when moving */
const arrowPosition = writable({ x: 0, y: 0 }) const arrowPosition = writable({ x: 0, y: 0 })
/**
*
*/
/** Move arrow and define direction on mousemove */ /** Move arrow and define direction on mousemove */
const handleArrowMove = (event: MouseEvent) => { const handleArrowMove = (event: MouseEvent) => {
const { left, top, width } = carouselEl.getBoundingClientRect() const { left, top, width } = carouselEl.getBoundingClientRect()
@@ -88,7 +82,7 @@
}) })
</script> </script>
<div class="carousel {$$props.class ? $$props.class : ''}"> <div class="carousel {$$props.class ?? ''}">
{#if slides.length} {#if slides.length}
<div class="carousel__viewport" bind:this={carouselEl} <div class="carousel__viewport" bind:this={carouselEl}
on:mousemove={handleArrowMove} on:mousemove={handleArrowMove}