Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

holy-stars

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

holy-stars

Simple stars widget

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
179
decreased by-9.14%
Maintainers
1
Weekly downloads
 
Created
Source

Holy Stars

Simple rate widget

LIVE DEMO

import 'holy-stars/index.css'
import { HolyStars } from 'holy-stars'

const stars = new HolyStars({
  el: document.getElementById('stars'),
  rate: 4.4,
  size: 16,
  primaryColor: '#FFE135',
  secondColor: '#ddd',
})

stars.update({
  rate: 4,
  size: 24,
})

Custom entry template

import { HolyStars, HolyRender } from 'holy-stars'

const renderTemplate = ({size = 12, primaryColor, secondColor}, offset = 1) => {
  return `
      <div class="holy-stars__entity" style="width: ${size}px; height: ${size}px">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${24 * offset} 24" width="${size * offset}" height="${size}">
          <path fill="${primaryColor}" d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"/>
        </svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="${size}" height="${size}">
          <path fill="${secondColor}" d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"/>
        </svg>
      </div>`
}
const render = new HolyRender(renderTemplate)

const stars1 = new HolyStars({
  el: document.getElementById('stars1'),
  rate: 4.4,
  size: 16,
  primaryColor: '#FFE135',
  secondColor: '#ddd',
}, render)

const stars2 = new HolyStars({
  el: document.getElementById('stars2'),
  rate: 4.4,
  size: 16,
  primaryColor: '#FFE135',
  secondColor: '#ddd',
}, render)

Keywords

FAQs

Package last updated on 10 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc