# commit-calendar

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

Latest version **1.1.2** (published 2024-01-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install commit-calendar
pnpm add commit-calendar
yarn add commit-calendar
bun add commit-calendar
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2024-01-02 |
| First published | 2023-12-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 175.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | sheepeer |
| Keywords | calendar, git, commit |

## Links

- npm: https://www.npmjs.com/package/commit-calendar
- Repository: https://github.com/Sheepeer/commit-calendar
- Homepage: https://sheepeer.github.io/commit-calendar/
- Issues: https://github.com/Sheepeer/commit-calendar/issues
- npm.io page: https://npm.io/package/commit-calendar

## Dependencies (4)

- [dayjs](https://npm.io/package/dayjs.md) ^1.11.10
- [@babel/cli](https://npm.io/package/@babel/cli.md) ^7.23.4
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.23.6
- [@emotion/react](https://npm.io/package/@emotion/react.md) ^11.11.3

## Recent versions

- 1.1.2 (latest) — 2024-01-02
- 1.1.1 — 2024-01-02
- 1.1.0 — 2023-12-26
- 1.0.0 — 2023-12-25

## README

# 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](https://github.com/Sheepeer/commit-calendar/assets/78125933/bc118ab7-7b50-4c40-bb3f-76f547120da8)

## 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

<ins>Required</ins>. Including three segments:

- bgColor: Array<string>;
- borderColor: Array<string>;
- minCount: Array<number>;

### weekLabelStyles

<ins>Optional</ins>. Including two segments:

- color?: string;
- fontSize?: string;

### monthLabelStyles

<ins>Optional</ins>. Same with weekLabelStyles.

### itemStyles

<ins>Optional</ins>. Including three segments:

- bgColor?: string;
- borderColor?: string;
- borderRadius?: string;

### footer

<ins>Optional</ins>. Including five segments:

- bottomTip?: React.ReactNode;
- lessText?: string;
- moreText?: string;
- lessTextColor?: string;
- moreTextColor?: string;

## Todo

- [x] enable choosing year
- [x] enable customizing color
- [ ] supporting different locale

## Change Log

**v1.0.0** 2023-12-25

- :guitar: Finish basic commit-calendar component and publish to npmjs.com

**v1.1.0** 2023-12-29

- :guitar: Support changing year
- :bug: Fix cols displayed wrong

**v1.1.1** 2023-01-02

- :guitar: Support custom styles

**v1.1.2** 2023-01-02

- :pencil2: Update docs and publish homepage with git pages

---
_Source: https://npm.io/package/commit-calendar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
