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

like-button-celebration

v1.0.2

Published

like-button-celebration designed to add animated buttons for liking, unliking, upvoting, and custom interactions to your blogs, articles, and web content. With this library, you can easily integrate interactive buttons that celebrate user clicks, adding d

Downloads

1,759

Readme

like-button-celebration

Like-button-celebration designed to add animated buttons for liking, unliking, upvoting, and custom interactions to your blogs, articles, and web content. With this library, you can easily integrate interactive buttons that celebrate user clicks, adding delightful animations to your web applications.

NPM JavaScript Style Guide

Install

npm install --save like-button-celebration party-js

Usage

Heart Like button

heart-Like.gif

import React, {useState} from 'react'
import { HeartLike } from 'like-button-celebration'

const App = () => {
    const [liked, SetLiked] = useState(user.liked)
  return (
    <>
        <HeartLike 
        //set the State of the Button. ie. Liked or Not
        Active={liked}  // Default true
        />
    </>
    )
}

export default App

The HeartLike component is designed for heart-shaped like buttons and provides various customization options. Here's a breakdown of the props it accepts, along with their usage and default values:

  • Active (boolean, optional, default: true): Determines the initial state of the button. Set to true for a liked state and false for an unliked state.

  • IconWidth (string, optional, default: '24'): Specifies the width of the heart icon.

  • IconHeight (string, optional, default: '24'): Specifies the height of the heart icon.

  • Image (string, optional): URL of an image to use as the Animation Particles. When provided, it will replace the default Square and Circle particles.

  • Speed (object, optional): An object with Min and Max properties to control the animation speed. For example:

    Speed={{
      Min: 100, // Minimum animation speed in milliseconds
      Max: 400, // Maximum animation speed in milliseconds
    }}
  • Spread (number, optional, default: 50): Controls the spread of confetti particles when the button is clicked.

  • Count (object, optional): An object with Min and Max properties to control the number of confetti particles. For example:

    Count={{
    Min: 20, // Minimum number of confetti particles
    Max: 50, // Maximum number of confetti particles
    }}

example

     <HeartLike
        Active={true}
        IconWidth="32"
        IconHeight="32"
        Image="https://example.com/custom-heart-icon.png"
        Speed={{
          Min: 200,
          Max: 600,
        }}
        Spread={70}
        Count={{
          Min: 30,
          Max: 60,
        }}
        Fill="blue"
      />

Thumbs Up Like

Props same as Above Heart Like Button. likebutton.gif

Example

import React, {useState} from 'react'
import { ThumbLike } from 'like-button-celebration'

const App = () => {
    const [liked, SetLiked] = useState(user.liked)
    return 
    (
    <div>
        <ThumbLike
                Active={true} 
                IconWidth="32" 
                IconHeight="32"
                Image="https://example.com/custom-thumb-icon.png" 
                Speed={{
                Min: 200, // Minimum animation speed in milliseconds (optional, default: 100)
                Max: 600, // Maximum animation speed in milliseconds (optional, default: 400)
                }}
                Spread={70} // Control the spread of confetti particles (optional, default: 50)
                Count={{
                Min: 30, // Minimum number of confetti particles (optional, default: 20)
                Max: 60, // Maximum number of confetti particles (optional, default: 50)
                }}
                Fill="blue" 
            />
    </div>
    )
}

export default App

Custom Button with Celebration Animation

Remember, The BeforeClick and AfterClick props are required, and they determine the content to display before and after clicking the button.

Example

import React from 'react';
import { CustomButton } from 'like-button-celebration'

function App() {
  return (
    <div>
      <CustomButton
        // Required
        BeforeClick={<div>Click Me!</div>}
        AfterClick={<div>Clicked!</div>}

        // Optional
        Image="https://example.com/custom-icon.png"
        Speed={{
          Min: 200,
          Max: 600,
        }}
        Spread={70}
        Count={{
          Min: 30,
          Max: 60,
        }}
        
      />
    </div>
  );
}

export default App;

License

MIT © mayurjadhav2002

Feedback

If you have any feedback, please reach out to us at [email protected]

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.