Socket
Socket
Sign inDemoInstall

taro-calendar-heatmap

Package Overview
Dependencies
11
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    taro-calendar-heatmap

A calendar heatmap component build by taro.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Taro Calendar Heatmap

基于 Taro 的日历热力图,生成类似于 GitHub Contribution 统计图。

Todo

  • 展示 Tooltip
  • 点击回调以及样式
  • 适配 Dark Mode

安装与引入

安装

npm i taro-calendar-heatmap --save

引入

import CalendarHeatmap from 'taro-calendar-heatmap';
// 引入样式
import 'taro-calendar-heatmap/dist/index.css';

组件使用

const data = [
  { date: '2021-3-24', count: 6 },
  { date: '2021-3-25', count: 1 },
  { date: '2021-3-26', count: 4 },
  { date: '2021-3-27', count: 5 },
  { date: '2021-3-28', count: 7 },
];
<CalendarHeatMap data={data} showMonthLabel showWeekLabel theme="github" />;

API

参数说明类型默认值
spacing方块的间隙number1
squareWidth方块的宽度number14
radius方块的弧度number3
colorRange颜色范围,第一个颜色值为方块未填充的颜色string[][]
theme日历主题github | purple | volcano | blue | orangegithub
startDate开始时间,可以传时间字符串、Date、时间戳string | Date | numberOne year ago
endDate结束时间,可以传时间字符串、Date、时间戳string | Date | numberToday
showWeekLabel是否显示周标签booleanfalse
showMonthLabel是否显示月份标签booleanfalse
firstDay每周的第一天MonSun
data日历数据DataProp[][]
onClick点击回调,可以在回调可以获取点击的日期时间Function(date: Date ) => {}
showTooltip点击是否显示提示booleanfalse
tooltipContent提示框内容,可以穿字符串或者组件。stringElement

DataProp

参数说明类型默认值
count次数,次数越多,颜色越深number0
date可以传时间字符串、Date、时间戳string | Date | numbernull

Theme

组件内置了 GitHub、酱紫、火山、极客蓝、日暮五种主题,效果如下。

theme主题名称截图
githubGitHubIMG_0460EB86E4FA-1
purple酱紫IMG_BAE84FD8F6A4-1
volcano火山IMG_2D06301BC78A-1
blue极客蓝IMG_A2F31DAC7516-1
orange日暮IMG_B861E55C242B-1

Keywords

FAQs

Last updated on 30 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc