GithubHelp home page GithubHelp logo

commit-calendar's Introduction

commit-calendar

Introduce

A calendar which is like github commit calendar, but the data to be displayed is decided by yourself.

Quick Start

install

npm install commit-calendar

example

You can use this in your react project like this:

const Page = () => {
  const data = [
    { date: '2023-01-01', count: 2 },
    { date: '2023-01-02', count: 2 },
    { date: '2023-02-03', count: 1 },
    { date: '2023-05-11', count: 5 },
    { date: '2023-07-20', count: 10 },
    { date: '2023-09-10', count: 4 },
    { date: '2023-11-27', count: 3 },
  ]
  return (
    <>
      <!-- other codes -->
      <CommitCalendar dataSource={data} />
      <!-- other codes -->
    </>
  )
}

Then you will see the calendar: image

Props List

name meaning type
dataSource Array containing date and count Array<{ date: any, count:number }>
options configuration of calendar styles Object (see next part: Options)
year which year to be displayed number or string or Date

Options

range

Required. Including three segments:

  • bgColor: Array;
  • borderColor: Array;
  • minCount: Array;

weekLabelStyles

Optional. Including two segments:

  • color?: string;
  • fontSize?: string;

monthLabelStyles

Optional. Same with weekLabelStyles.

itemStyles

Optional. Including three segments:

  • bgColor?: string;
  • borderColor?: string;
  • borderRadius?: string;

footer

Optional. Including five segments:

  • bottomTip?: React.ReactNode;
  • lessText?: string;
  • moreText?: string;
  • lessTextColor?: string;
  • moreTextColor?: string;

Todo

  • enable choosing year
  • enable customizing color
  • supporting different locale

Change Log

v1.0.0 2023-12-25

  • ๐ŸŽธ Finish basic commit-calendar component and publish to npmjs.com

v1.1.0 2023-12-29

  • ๐ŸŽธ Support changing year
  • ๐Ÿ› Fix cols displayed wrong

v1.1.1 2023-01-02

  • ๐ŸŽธ Support custom styles

v1.1.2 2023-01-02

  • โœ๏ธ Update docs and publish homepage with git pages

commit-calendar's People

Contributors

sheepeer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.