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

@viviedu/react-clock

v3.0.0-vivi9

Published

An analog clock for your React app.

Downloads

579

Readme

npm downloads CI dependencies dev dependencies tested with jest

React-Clock

An analog clock for your React app.

tl;dr

  • Install by executing npm install @viviedu/react-clock or yarn add @viviedu/react-clock.
  • Import by adding import Clock from '@viviedu/react-clock'.
  • Use by adding <Clock />.

Demo

A minimal demo page can be found in sample directory.

Installation

Add React-Clock to your project by executing npm install @viviedu/react-clock or yarn add @viviedu/react-clock.

Usage

Here's an example of basic usage:

import React, { useEffect, useState } from 'react';
import Clock from '@viviedu/react-clock';

function MyApp() {
  const [value, setValue] = useState(new Date());

  useEffect(() => {
    const interval = setInterval(
      () => setValue(new Date()),
      1000
    );

    return () => {
      clearInterval(interval);
    }
  }, []);

  return (
    <div>
      <p>Current time:</p>
      <Clock value={value} />
    </div>
  )
}

Custom styling

If you want to use default React-Clock styling to build upon it, you can import React-Clock's styles by using:

import '@viviedu/react-clock/dist/Clock.css';

User guide

Clock

Displays a complete clock.

Props

|Prop name|Description|Default value|Example values| |----|----|----|----| |className|Class name(s) that will be added along with "react-clock" to the main React-Clock <time> element.|n/a|String: "class1 class2"Array of strings: ["class1", "class2 class3"]| |hourHandLength|Hour hand length, in %.|50|80| |hourHandOppositeLength|The length of the part of an hour hand on the opposite side the hand is pointing to, in %.|10|20| |hourHandWidth|Hour hand width, in pixels.|4|3| |hourMarksLength|Hour marks length, in %.|10|8| |hourMarksWidth|Hour marks width, in pixels.|3|2| |minuteHandLength|Minute hand length, in %.|70|80| |minuteHandOppositeLength|The length of the part of a minute hand on the opposite side the hand is pointing to, in %.|10|20| |minuteHandWidth|Minute hand width, in pixels.|2|3| |minuteMarksLength|Minute marks length, in %.|6|8| |minuteMarksWidth|Minute marks width, in pixels.|1|2| |numbersMultiplier|What to multiply each number by (e.g. for a stopwatch).|1|5| |preciseSecondHandAngle|Whether to take milliseconds into account when calculating the angle of the seconds hand.|false|true| |renderHourMarks|Whether hour marks shall be rendered.|true|false| |renderHourHand|Whether hour hand shall be rendered.|true|false| |renderMinuteHand|Whether minute hand shall be rendered.|true|false| |renderMinuteMarks|Whether minute marks shall be rendered.|true|false| |renderNumbers|Whether numbers shall be rendered.|false|true| |renderSecondHand|Whether second hand shall be rendered.|true|false| |secondHandLength|Second hand length, in %.|90|80| |secondHandOppositeLength|The length of the part of a second hand on the opposite side the hand is pointing to, in %.|10|20| |secondHandWidth|Second hand width, in pixels.|1|2| |size|Clock size, in pixels.|150|250| |value|Clock value. Must be provided.|n/a|Date: new Date()|

License

The MIT License.