Add Carousel components (#75)

* Add carousel components

* Fix "Carousel.vue" indentation

* Fix "CarouselItem.vue" indentation
This commit is contained in:
Andreas E 2019-10-04 16:22:01 +02:00 committed by Simon M
parent 455f45161d
commit 2c797d433f
4 changed files with 71 additions and 18 deletions

View File

@ -0,0 +1,46 @@
<template>
<div class="carousel-root">
<div class="carousel" v-bind:id="name">
<slot />
</div>
<script>
var config = {{ config }};
new Flickity("#{{ name }}", config)
</script>
</div>
</template>
<script>
export default {
props: {
name: {
type: String,
required: true
},
config: {
type: Object,
default: function () {
return {
adaptiveHeight: true,
wrapAround: true,
pageDots: false
}
}
}
}
}
</script>
<style>
.carousel {
background: #F0F4F8;
border-radius: 1em;
}
.flickity-button {
position: absolute;
background: hsla(0,0%,100%,.75);
border: none;
color: rgba(44, 62, 80);
}
</style>

View File

@ -0,0 +1,25 @@
<template>
<div class="carousel-cell" v-bind:id="name">
<slot />
</div>
</template>
<script>
export default {
name: "carousel-item",
props: {
name: {
type: String,
default: "carousel-cell"
}
}
}
</script>
<style>
.carousel-cell {
width: 100%;
margin-right: 16px;
margin-left: 16px;
}
</style>

View File

@ -5,7 +5,6 @@ module.exports = {
head: [ head: [
['script', { src: 'https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js'} , ''], ['script', { src: 'https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js'} , ''],
['link', { rel: "stylesheet", type: "text/css", href: 'https://unpkg.com/flickity@2/dist/flickity.min.css'} , ''], ['link', { rel: "stylesheet", type: "text/css", href: 'https://unpkg.com/flickity@2/dist/flickity.min.css'} , ''],
['link', { rel: "stylesheet", type: "text/css", href: '/assets/css/carousel.css'} , '']
], ],
themeConfig: { themeConfig: {
repo: 'inorichi/tachiyomi', repo: 'inorichi/tachiyomi',

View File

@ -1,17 +0,0 @@
.carousel {
background: #F0F4F8;
border-radius: 1em;
}
.carousel-cell {
width: 100%; /* full width */
margin-right: 16px;
margin-left: 16px;
}
.flickity-button {
position: absolute;
background: hsla(0,0%,100%,.75);
border: none;
color: rgba(44, 62, 80);
}