Skip to content

Commit 26225ce

Browse files
authored
Merge pull request #18 from hanssagita/release/0.8.0
Release/0.8.0
2 parents b7656c2 + 2a2a7ff commit 26225ce

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 🐱🐱🐱 Vue-Cat-Carousel 🐱🐱🐱
22

33

4-
Simple and lightest Carousel
4+
Simple, customizable, reactive and lightest Carousel
55

66

77
## Install
@@ -48,8 +48,7 @@ How to use it in HTML
4848
<cat-carousel
4949
:items="items"
5050
:item-per-page="5"
51-
:hide-indicators="false"
52-
:indicators-item-size="10"
51+
:indicators-config="{activeColor: '#000', size: 10, color: '#d1d1d1', hideIndicators: false}"
5352
>
5453
<template
5554
slot="item"
@@ -84,7 +83,6 @@ Slider:
8483
| --------------- | -------------------------------- | ---------- | ---------------------------------------------------------------------- |
8584
| items | list | [] | List of items in loop |
8685
| item-per-page | number | 5 | List of items in one page |
87-
| hide-indicators | boolean | false | show and hide carousel indicators |
8886
| indicators-config | Object | INDICATORS_DEFAULT_CONFIG | define carousel indicators item size |
8987

9088
INDICATORS_DEFAULT_CONFIG
@@ -94,6 +92,7 @@ property | type | value | description
9492
size | number | 16 | size of indicators in pixel
9593
color | string | '#d6d6d6' | color of indicators (hex, rgb, etc)
9694
activeColor | string | '#0095da' | color of active indicator (hex, rgb, etc)
95+
hideIndicators | boolean | false | show and hide carousel indicators
9796

9897
## Slots
9998

@@ -108,8 +107,7 @@ Previous navigation:
108107
<cat-carousel
109108
:items="items"
110109
:item-per-page="5"
111-
:hide-indicators="false"
112-
:indicators-item-size="10"
110+
:indicators-config="{activeColor: '#000', size: 10, color: '#d1d1d1', hideIndicators: false}"
113111
>
114112
<template
115113
slot="prev-navigation"
@@ -125,8 +123,7 @@ Next navigation:
125123
<cat-carousel
126124
:items="items"
127125
:item-per-page="5"
128-
:hide-indicators="false"
129-
:indicators-item-size="10"
126+
:indicators-config="{activeColor: '#000', size: 10, color: '#d1d1d1', hideIndicators: false}"
130127
>
131128
<template
132129
slot="prev-navigation"

demo/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@
107107
<cat-carousel
108108
:items="products"
109109
:item-per-page="itemPerPage"
110-
:hide-indicators="false"
111-
:indicators-config="{activeColor: '#000', size: 10, color: '#d1d1d1'}"
110+
:indicators-config="{activeColor: '#000', size: 10, color: '#d1d1d1', hideIndicators: false}"
112111
>
113112
<template
114113
slot="item"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cat-carousel",
3-
"version": "0.8.0",
3+
"version": "0.8.3",
44
"description": "vue-cat-carousel is a slider component of Vue.js.",
55
"keywords": [
66
"slide",

src/CatCarousel.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<template>
88
<slot name="prev-navigation" :prev="prev">
99
<div class="cat-carousel__default-nav cat-carousel__default-nav--left" @click="prev">
10-
<img src="https://i.imgur.com/JkraWHJ.png">
10+
<img src="https://i.imgur.com/PpHTPrc.png">
1111
</div>
1212
</slot>
1313
</template>
@@ -47,7 +47,7 @@
4747
<template>
4848
<slot name="next-navigation" :next="next">
4949
<div class="cat-carousel__default-nav" @click="next">
50-
<img src="https://i.imgur.com/JkraWHJ.png">
50+
<img src="https://i.imgur.com/PpHTPrc.png">
5151
</div>
5252
</slot>
5353
</template>
@@ -104,28 +104,29 @@
104104
right: 0;
105105
}
106106
&--end {
107-
opacity: 0.5;
107+
display: none;
108108
}
109109
}
110110
&__default-nav {
111-
width: 32px;
112-
height: 72px;
111+
width: 48px;
112+
height: 48px;
113+
opacity: 0.88;
114+
box-shadow: 0 0 24px -4px rgba(0, 0, 0, 0.24);
115+
background-color: #ffffff;
113116
display: flex;
114117
justify-content: center;
115118
align-content: center;
116119
align-items: center;
117-
border-radius: 5px;
118-
box-shadow: 1px 2px 5px -1px #b0b0b0;
120+
border-radius: 50%;
119121
border-right: 1px solid #eee;
120-
background-color: rgba(255, 255, 255, 0.2);
121122
cursor: pointer;
122123
z-index: 2;
123124
@media only screen and (max-width: 768px) {
124125
display: none;
125126
}
126127
img {
127-
width: 32px;
128-
height: 32px;
128+
width: 34px;
129+
height: 34px;
129130
}
130131
&--left {
131132
img {

src/cat-carousel.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const SWIPE_THRESHOLD = 80
33
const INDICATORS_DEFAULT_CONFIG = {
44
size: 16,
55
color: '#d6d6d6',
6-
activeColor: '#0095da'
6+
activeColor: '#0095da',
7+
hideIndicators: false
78
}
89

910
export default {
@@ -18,10 +19,6 @@ export default {
1819
type: Number,
1920
default: 5
2021
},
21-
hideIndicators: {
22-
type: Boolean,
23-
default: false
24-
},
2522
indicatorsConfig: {
2623
type: Object,
2724
default: () => {
@@ -45,8 +42,14 @@ export default {
4542
},
4643
mounted () {
4744
this.maxSlide = Math.ceil(this.items.length / this.itemPerPage)
48-
this.initSlides()
4945
this.itemWidth = this.carouselItem.length > 0 && this.carouselItem[0].clientWidth
46+
this.initSlides()
47+
},
48+
watch: {
49+
items () {
50+
this.maxSlide = Math.ceil(this.items.length / this.itemPerPage)
51+
this.itemWidth = this.carouselItem.length > 0 && this.carouselItem[0].clientWidth
52+
}
5053
},
5154
computed: {
5255
carouselContent () {
@@ -86,6 +89,9 @@ export default {
8689
return {
8790
backgroundColor: this.indicatorsConfig.activeColor || INDICATORS_DEFAULT_CONFIG.activeColor
8891
}
92+
},
93+
hideIndicators () {
94+
return this.indicatorsConfig.hideIndicators || INDICATORS_DEFAULT_CONFIG.hideIndicators
8995
}
9096
},
9197
methods: {
@@ -124,7 +130,6 @@ export default {
124130
this.touchX = event.touches[0].clientX
125131
},
126132
touchMove (event) {
127-
event.preventDefault()
128133
if (!this.touchX) return
129134
let currentX = event.touches[0].clientX
130135
let diffX = currentX - this.touchX

0 commit comments

Comments
 (0)