Skip to content

Commit

Permalink
feat: adds icon via slots
Browse files Browse the repository at this point in the history
  • Loading branch information
SinanMtlTek committed Apr 14, 2022
1 parent 81bc48c commit 2ff86c2
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 77 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Vue Rate

[![npm version](https://badge.fury.io/js/vue-rate@next.svg)](https://www.npmjs.com/package/vue-rate@next)
[![npm](https://img.shields.io/npm/dt/vue-rate@next.svg)](https://www.npmjs.com/package/vue-rate@next)
[![npm version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=js&r=r&type=6e&v=3.0.0&x2=0)](https://www.npmjs.com/package/vue-rate/v/3.0.0)
[![npm](https://img.shields.io/npm/dt/vue-rate.svg)](https://www.npmjs.com/package/vue-rate/v/3.0.0)

> Rate component for Vue - [Demo](https://sinanmtl.github.io/vue-rate/).
> Note: This version for Vue 3. If you want to use for Vue 2.x, please [see](https://github.com/SinanMtl/vue-rate/tree/master).
Expand Down Expand Up @@ -85,6 +85,31 @@ Then add Rate component. `iconref` must be symbol's id
<rate :length="5" iconref="icon-heart" />
```

- `slot`: Custom icon via slot

You can directly use custom icon via default slot
```html
<rate :length="5" :value="3" :ratedesc="desc" class="viaSlot">
<svg class="icon" width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M12.034 7.074H19.416L13.445 11.448L15.726 18.524L9.75201 14.151L3.77901 18.524L6.06101 11.448L0.0880127 7.075H7.47001L9.75201 0.002V0L12.034 7.075V7.074Z"
fill="currentColor"/>
</svg>
</rate>
```

Add some flavour
```css
.RateCustom.viaSlot .icon {
width: 25px;
height: 25px;
}
.Rate.viaSlot .Rate__star.filled{color: #813d1a;}
.Rate.viaSlot .Rate__star.hover{color: #E67136;}
```

- `v-model`

```javascript
Expand Down
69 changes: 39 additions & 30 deletions dist/vue-rate.common.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vue-rate.common.js.map

Large diffs are not rendered by default.

69 changes: 39 additions & 30 deletions dist/vue-rate.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vue-rate.umd.js.map

Large diffs are not rendered by default.

0 comments on commit 2ff86c2

Please sign in to comment.