https://github.com/fireyy/emoji-vote
Vote use emoji.
https://github.com/fireyy/emoji-vote
emoji vote
Last synced: 7 months ago
JSON representation
Vote use emoji.
- Host: GitHub
- URL: https://github.com/fireyy/emoji-vote
- Owner: fireyy
- Created: 2017-11-30T05:32:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-12T01:47:08.000Z (over 8 years ago)
- Last Synced: 2025-08-09T05:34:13.973Z (12 months ago)
- Topics: emoji, vote
- Language: HTML
- Homepage:
- Size: 125 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# emoji-vote
> Emoji vote component.
- Idea from [支付宝商户评论页的满意度 Emoji 会跟随用户的当前选择看向该 Icon](http://uedetail.com/archives/3832).
- Emoji from [EmojiOne™ 2](https://emojitwo.github.io/).
## Install
This project uses [node](http://nodejs.org) and [npm](https://npmjs.com). Go check them out if you don't have them locally installed.
```sh
$ npm install --save emoji-vote
```
Then with a module bundler like [rollup](http://rollupjs.org/) or [webpack](https://webpack.js.org/), use as you would anything else:
```javascript
// using ES6 modules
import emojiVote from 'emoji-vote'
// using CommonJS modules
var emojiVote = require('emoji-vote')
```
The [UMD](https://github.com/umdjs/umd) build is also available on [unpkg](https://unpkg.com):
```html
```
This exposes the `emojiVote()` function as a global.
* * *
## Usage
```html
不满
一般
满意
满意
```
```js
import emojiVote from 'emoji-vote'
emojiVote('.emoji', {
size: 30
})
```
## Examples & Demos
[**Real Example on JSFiddle**](https://jsfiddle.net/fireyy/q1c2zcya/) ➡️
## API
emoji-vote's API is organized as follows:
### `emojiVote(el: String|Element, options: Object)`
emojiVote will account for the following properties in options:
* `emoji` The emoji data array, default:
```js
[
`
`,
`
`,
...
]
```
* `render` The render function for create svg, default:
```js
function (data, size) {
return `
${data}
`
}
```
* `size` The emoji size, default to `20px`.
## TODO
- [x] custom emoji svg template.
- [ ] custom emoji color config