Add base styles
This commit is contained in:
@@ -1,10 +1,44 @@
|
|||||||
<script>
|
<script>
|
||||||
export let title = 'Hello';
|
/**
|
||||||
|
* Enable Next/Previos arrows
|
||||||
|
*/
|
||||||
|
export let arrows = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<div class="main-container">
|
||||||
<h1>{title}</h1>
|
{#if arrows}
|
||||||
</main>
|
<div class="side-container">
|
||||||
|
<span class="clickable"><</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="content-container">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
{#if arrows}
|
||||||
|
<div class="side-container">
|
||||||
|
<span class="clickable">></span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.main-container {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.content-container {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.side-container {
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
height: 100%;
|
||||||
|
padding: 5px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
import ImageCarousel from './ImageCarousel.svelte';
|
import ImageCarouselView from './ImageCarouselView.svelte';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'ImageCarousel',
|
title: 'ImageCarousel',
|
||||||
component: ImageCarousel,
|
component: ImageCarouselView,
|
||||||
argTypes: {
|
argTypes: {
|
||||||
title: { control: 'text' },
|
arrows: { control: 'boolean' },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const Template = ({ ...args }) => ({
|
const Template = ({ ...args }) => ({
|
||||||
Component: ImageCarousel,
|
Component: ImageCarouselView,
|
||||||
props: args,
|
props: args,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Primary = Template.bind({});
|
export const Primary = Template.bind({});
|
||||||
Primary.args = {
|
Primary.args = {
|
||||||
title: 'This is a title'
|
arrows: true
|
||||||
};
|
};
|
||||||
22
src/stories/ImageCarouselView.svelte
Normal file
22
src/stories/ImageCarouselView.svelte
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<script>
|
||||||
|
import ImageCarousel from '../ImageCarousel.svelte'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable Next/Previos arrows
|
||||||
|
*/
|
||||||
|
export let arrows = true;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="main-container">
|
||||||
|
<ImageCarousel {arrows} >
|
||||||
|
<h1>Element 1</h1>
|
||||||
|
<h1>Element 2</h1>
|
||||||
|
</ImageCarousel>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.main-container {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user