Change some $$props.class to shorthands
This commit is contained in:
@@ -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()}
|
||||||
|
|||||||
@@ -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}
|
||||||
|
|||||||
Reference in New Issue
Block a user