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

yearrecord

v0.0.4

Published

A react component that displays data for each day of the year

Downloads

2

Readme

yearrecord

A react component that displays data for each day of the year

install

npm install yearrecord

use

In a React project, you can use it like this:

import YearRecord from "yearrecord"

function App() {

  return (
    <>
      <YearRecord
        themeColor="green"
        tooltipTitileFunc={item => `${item.year}年${item.month}月${item.day}日, ${item.data}次浏览`}
      ></YearRecord>
    </>
  )
}

export default App

then you will see: image

API

API of YearRecord

| prop | type | default value | description | | :-------------------: | :------: | :--------------------: | :---------------------------------------------------------- | | itemWidth | string | “10px” | width of div of the single day record | | itemHeight | string | "10px" | height of div of the single day record | | itemBorderRadius | string | "3px" | border-radius of the div of the single day record | | gridRowGap | string | "3px" | row gap, used in grid layout | | gridColumnGap | string | "3px" | column gap, used in grid layout | | year | number | current year | year of the data | | data | Array | random generate | the data to display, it's format is up to the prop compact. If compact === true, data is an Array of length n, and the i-th item is the data of month i+1, the length of month data is up to the count of days of that month, then format of a single day record is: {yaer: number, month: number, day:number, data: number}; if compact === falsedata will be an Array of length n, it conatins n single day records. In other words, data is a 2-d array if compact === true, else data is a 1-d array. | | themeColor | string | "#39d353" | a string representing a color which can be used in css, sunch as: red, rgb(0,0,0), #eee, etc. | | tooltipTitileFunc | function | _ => "tooltip title" | this function accept a single day record object as it's parameter, and return a string which will be used as the tooltip title. | | tooltipTitlePlacement | string | "top" | the placement of the tooltip title, it is one of ["top", "bottom", "left", "right"] | | compact | boolean | false | if compact===true, then there will be no gap among months, and the format of data need to be changed. |

API of MonthRecord

The props of MonthRecord is almost the same as YearRecord, because the props of the later are from the former, in other words, the most props of YearRecord will be directly passed to MonthRecord.The only prop MonthRecord has more than YearRecord is month:

| prop | type | default value | description | | :-----: | ------- | ------------- | ------------------------------------------------------------ | | month | number | current month | it will be displayed as a Chinese string below the component, such as "7月" | | compact | boolean | false | if true, the component will ignore prop month, and display nothing below itself. |

API of Tooltip

| prop | type | default value | description | | --------- | ------ | ------------- | ------------------------ | | title | string | "" | tooltip title | | placement | string | "top" | the same as yearrecord |