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

alpha-countdown

v1.1.0

Published

A customizable React component for displaying countdowns with various options and styling with types.

Downloads

13

Readme

Alpha Countdown

A customizable React component for displaying countdowns with various options and styling with types.

Installation

npm install alpha-countdown

Demo

Usage

import AlphaCountDown from "alpha-countdown";
import { useEffect, useState } from "react";

export default function Home() {
  const [totalDuration, setTotalDuration] = useState(0);
  const [completed, setCompleted] = useState(false);

  useEffect(() => {
    console.log("🚀 ~ useEffect ~ completed:", completed);
  }, [completed]);

  useEffect(() => {
    console.log("🚀 ~ useEffect ~ totalDuration:", totalDuration);
  }, [totalDuration]);

  function getRemainingDurationinSeconds(remainingDurationinSeconds: number) {
    console.log(
      "🚀 ~ getRemainingDurationinSeconds ~ remainingDurationinSeconds:",
      remainingDurationinSeconds
    );
  }

  function getProgress(progress: number) {
    console.log(
      "🚀 ~ getRemainingDurationinSeconds ~ remainingDurationinSeconds:",
      progress
    );
  }

  return (
    <AlphaCountDown
      getTotalDuration={setTotalDuration}
      getRemainingDuration={getRemainingDurationinSeconds}
      getCompleted={setCompleted}
      getProgress={getProgress}
      reverse={true}
      showLive={true}
      smoothProgress={true}
    />
  );
}

Props

Required Props

endTime

  • Type: Date
  • Description: The end time for the countdown.

Optional Props

getTotalDuration

  • Type: Function
  • Description: Callback function to get the total duration.

getRemainingDuration

  • Type: Function
  • Description: Callback function to get the remaining duration in seconds.

getCompleted

  • Type: Function
  • Description: Callback function to get the completion status.

getProgress

  • Type: Function
  • Description: Callback function to get the progress percentage.

onComplete

  • Type: String
  • Description: The message or action to trigger when the countdown is complete.

reverse

  • Type: Boolean
  • Default: true
  • Description: Reverse the countdown direction.

smoothProgress

  • Type: Boolean
  • Default: true
  • Description: Enable smooth progress animation.

showPercentage

  • Type: Boolean
  • Default: true
  • Description: Show or hide the percentage.

showCountDown

  • Type: Boolean
  • Default: true
  • Description: Show or hide the countdown timer.

showLive

  • Type: Boolean
  • Default: true
  • Description: Show or hide the live countdown updates.

showMilliSeconds

  • Type: Boolean
  • Default: false
  • Description: Show or hide milliseconds.

showOnlyRemainingTime

  • Type: Boolean
  • Default: false
  • Description: Show only the remaining time.

showYears, showMonths, showDays

  • Type: Boolean
  • Default: true
  • Description: Toggle to show years, months, and days.

percantageDecimals

  • Type: Number
  • Default: 0
  • Description: Number of decimal places for the percentage.

timeFormat

  • Type: String
  • Default: "short"
  • Description: Time format options: "short", "long", or false.

customTextBeforePercantage, customTextBeforeTime

  • Type: ReactNode
  • Description: Custom text or JSX elements to display before the percentage and time.

customOverlayForCompleted, customOverlayForInProgress

  • Type: ReactNode
  • Description: Custom content to overlay when the countdown is completed or in progress.

dateSeparator

  • Type: String
  • Default: "space"
  • Description: Separator for date elements: "-", ":", "space", or custom string.

containerStyles, progressBarStyles, overlayStyles, onCompleteStyles, inProgressStyles

  • Type: CSSProperties
  • Description: Custom styles for different components.

containerClassNames, progressBarClassNames, overlayClassNames, onCompleteClassNames, inProgressClassNames

  • Type: String
  • Description: Custom CSS class names for different components.

Feel free to experiment with these styling options to achieve the desired look and feel for your countdown component. If you encounter any issues or have suggestions for improvements, please open an issue on GitHub.

Coding is Love❤️