Rename ImageCarousel => Carousel
This commit is contained in:
102
src/Carousel/CarouselView.svelte
Normal file
102
src/Carousel/CarouselView.svelte
Normal file
@@ -0,0 +1,102 @@
|
||||
<script>
|
||||
import Carousel from './Carousel.svelte'
|
||||
|
||||
/**
|
||||
* Enable Next/Previos arrows
|
||||
*/
|
||||
export let arrows = true;
|
||||
|
||||
/**
|
||||
* Infinite looping
|
||||
*/
|
||||
export let infinite = true;
|
||||
|
||||
/**
|
||||
* Number of slides to show at a time
|
||||
*/
|
||||
export let slidesToShow = 1;
|
||||
|
||||
/**
|
||||
* Page to start on
|
||||
*/
|
||||
export let initialPageIndex = 1
|
||||
|
||||
/**
|
||||
* Transition speed (ms)
|
||||
*/
|
||||
export let speed = 500
|
||||
|
||||
/**
|
||||
* Enables auto play of slides
|
||||
*/
|
||||
export let autoplay = false
|
||||
|
||||
/**
|
||||
* Auto play change interval
|
||||
*/
|
||||
export let autoplaySpeed = 3000
|
||||
|
||||
/**
|
||||
* Auto play change direction ('next', 'prev')
|
||||
*/
|
||||
export let autoplayDirection = 'next'
|
||||
|
||||
/**
|
||||
* Current page indicator dots
|
||||
*/
|
||||
export let dots = true
|
||||
|
||||
const colors = [
|
||||
'#e5f9f0',
|
||||
'#ccf3e2',
|
||||
'#b2edd3',
|
||||
'#99e7c5',
|
||||
'#7fe1b7',
|
||||
'#66dba8',
|
||||
'#4cd59a',
|
||||
'#32cf8b',
|
||||
'#19c97d',
|
||||
'#00c36f'
|
||||
]
|
||||
</script>
|
||||
|
||||
<div class="main-container">
|
||||
<Carousel
|
||||
{arrows}
|
||||
{infinite}
|
||||
{slidesToShow}
|
||||
{initialPageIndex}
|
||||
{speed}
|
||||
{autoplay}
|
||||
{autoplaySpeed}
|
||||
{autoplayDirection}
|
||||
{dots}
|
||||
>
|
||||
{#each colors as color (color)}
|
||||
<div
|
||||
class="color-container"
|
||||
style="background-color: {color};"
|
||||
>
|
||||
<p>{color}</p>
|
||||
</div>
|
||||
{/each}
|
||||
</Carousel>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.main-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
.color-container {
|
||||
height: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.color-container > p {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
font-style: italic;
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user