npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

emoji-vote

v1.3.1

Published

Emoji vote component.

Downloads

3

Readme

emoji-vote

Emoji vote component.

Install

This project uses node and npm. Go check them out if you don't have them locally installed.

$ npm install --save emoji-vote

Then with a module bundler like rollup or webpack, use as you would anything else:

// using ES6 modules
import emojiVote from 'emoji-vote'

// using CommonJS modules
var emojiVote = require('emoji-vote')

The UMD build is also available on unpkg:

<script src="//unpkg.com/emoji-vote/dist/emoji-vote.cjs.js"></script>

This exposes the emojiVote() function as a global.


Usage

<div class="emoji">
  <input type="radio" name="emojiVote" id="emojiVote_dissatisfied" value="dissatisfied">
  <label for="emojiVote_dissatisfied">不满</label>
  <input type="radio" name="emojiVote" id="emojiVote_general" value="general">
  <label for="emojiVote_general">一般</label>
  <input type="radio" name="emojiVote" id="emojiVote_satisfied" value="satisfied">
  <label for="emojiVote_satisfied">满意</label>
  <input type="radio" name="emojiVote" id="emojiVote_awesome" value="awesome">
  <label for="emojiVote_awesome">满意</label>
</div>
import emojiVote from 'emoji-vote'

emojiVote('.emoji', {
  size: 30
})

Examples & Demos

Real Example on JSFiddle ➡️

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:

    [
      `
        <circle cx="20.5" cy="26.6" r="5"/>
        <circle cx="43.5" cy="26.6" r="5"/>
        <path d="M23 47.6c5.8-4.8 12.2-4.8 18 0 .7.6 1.3-.4.8-1.3-1.8-3.4-5.3-6.5-9.8-6.5s-8.1 3.1-9.8 6.5c-.5.9.1 1.9.8 1.3"/>
      `,
      `
        <circle cx="32" cy="45.1" r="7"/>
        <circle cx="20.2" cy="25" r="4.5"/>
        <circle cx="42.7" cy="25" r="4.5"/>
      `,
      ...
    ]
  • render The render function for create svg, default:

      function (data, size) {
        return `
          <svg class="emoji-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" style="font-size: ${size}px;">
            <circle class="emoji-facial" cx="32" cy="32" r="30" fill="#fff" stroke="#999" stroke-width="3" />
            <g class="emoji-facial-features" fill="#999">
              ${data}
            </g>
          </svg>
        `
      }
  • size The emoji size, default to 20px.

TODO

  • [x] custom emoji svg template.
  • [ ] custom emoji color config