Rename ImageCarousel => Carousel
This commit is contained in:
27
src/Carousel/Carousel.stories.js
Normal file
27
src/Carousel/Carousel.stories.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import CarouselView from './CarouselView.svelte';
|
||||||
|
import CarouselViewCustomDots from './CarouselViewCustomDots.svelte';
|
||||||
|
import CarouselViewCustomArrows from './CarouselViewCustomArrows.svelte';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'Carousel',
|
||||||
|
component: CarouselView
|
||||||
|
};
|
||||||
|
|
||||||
|
const Template = ({ ...args }) => ({
|
||||||
|
Component: CarouselView,
|
||||||
|
props: args
|
||||||
|
});
|
||||||
|
export const Primary = Template.bind({});
|
||||||
|
|
||||||
|
const TemplateCustomDots = ({ ...args }) => ({
|
||||||
|
Component: CarouselViewCustomDots,
|
||||||
|
props: args
|
||||||
|
});
|
||||||
|
export const WithCustomDots = TemplateCustomDots.bind({});
|
||||||
|
|
||||||
|
const TemplateCustomArrows = ({ ...args }) => ({
|
||||||
|
Component: CarouselViewCustomArrows,
|
||||||
|
props: args
|
||||||
|
});
|
||||||
|
export const WithCustomArrows = TemplateCustomArrows.bind({});
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
// TODO: rename image carousel to just carousel
|
// TODO: rename image carousel to just carousel
|
||||||
// TODO: subscribe on mount and unsubscribe on destroy to
|
|
||||||
import { onDestroy, onMount } from 'svelte'
|
import { onDestroy, onMount } from 'svelte'
|
||||||
import { store } from '../store'
|
import { store } from '../store'
|
||||||
import {
|
import {
|
||||||
@@ -70,7 +69,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
function applySlideSizes() {
|
function applySlideSizes() {
|
||||||
const children = innerContentContainerElement.children
|
const children = innerContentContainerElement ? innerContentContainerElement.children : []
|
||||||
pageWidth = contentContainerElement.clientWidth
|
pageWidth = contentContainerElement.clientWidth
|
||||||
|
|
||||||
const slidesCount = children.length
|
const slidesCount = children.length
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import ImageCarousel from './ImageCarousel.svelte'
|
import Carousel from './Carousel.svelte'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Next/Previos arrows
|
* Enable Next/Previos arrows
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<ImageCarousel
|
<Carousel
|
||||||
{arrows}
|
{arrows}
|
||||||
{infinite}
|
{infinite}
|
||||||
{slidesToShow}
|
{slidesToShow}
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<p>{color}</p>
|
<p>{color}</p>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</ImageCarousel>
|
</Carousel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import ImageCarousel from './ImageCarousel.svelte'
|
import Carousel from './Carousel.svelte'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Next/Previos arrows
|
* Enable Next/Previos arrows
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<ImageCarousel
|
<Carousel
|
||||||
{arrows}
|
{arrows}
|
||||||
{infinite}
|
{infinite}
|
||||||
{slidesToShow}
|
{slidesToShow}
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<span>>>></span>
|
<span>>>></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ImageCarousel>
|
</Carousel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import ImageCarousel from './ImageCarousel.svelte'
|
import Carousel from './Carousel.svelte'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Next/Previos arrows
|
* Enable Next/Previos arrows
|
||||||
*/
|
*/
|
||||||
export let arrows = true;
|
export let arrows = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Infinite looping
|
* Infinite looping
|
||||||
*/
|
*/
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<ImageCarousel
|
<Carousel
|
||||||
{arrows}
|
{arrows}
|
||||||
{infinite}
|
{infinite}
|
||||||
{slidesToShow}
|
{slidesToShow}
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ImageCarousel>
|
</Carousel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import ImageCarouselView from './ImageCarouselView.svelte';
|
|
||||||
import ImageCarouselViewCustomDots from './ImageCarouselViewCustomDots.svelte';
|
|
||||||
import ImageCarouselViewCustomArrows from './ImageCarouselViewCustomArrows.svelte';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: 'ImageCarousel',
|
|
||||||
component: ImageCarouselView
|
|
||||||
};
|
|
||||||
|
|
||||||
const Template = ({ ...args }) => ({
|
|
||||||
Component: ImageCarouselView,
|
|
||||||
props: args
|
|
||||||
});
|
|
||||||
export const Primary = Template.bind({});
|
|
||||||
|
|
||||||
const TemplateCustomDots = ({ ...args }) => ({
|
|
||||||
Component: ImageCarouselViewCustomDots,
|
|
||||||
props: args
|
|
||||||
});
|
|
||||||
export const WithCustomDots = TemplateCustomDots.bind({});
|
|
||||||
|
|
||||||
const TemplateCustomArrows = ({ ...args }) => ({
|
|
||||||
Component: ImageCarouselViewCustomArrows,
|
|
||||||
props: args
|
|
||||||
});
|
|
||||||
export const WithCustomArrows = TemplateCustomArrows.bind({});
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user