grubersjoe / react-activity-calendar

A flexible React component to display activity data in a calendar (heatmap).

Home Page:https://grubersjoe.github.io/react-activity-calendar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add click event?

zpaimon opened this issue · comments

hi
I want to add click event at rect ,but I don't know how to do ?
thanks.

Hey. I've added a property that allows to register event handlers. Simply update to v1.4.0 and check out docs here:
https://grubersjoe.github.io/react-activity-calendar/?path=/story/react-activity-calendar--event-handlers

Feel free to reopen this issue if needed.

<ActivityCalendar 
  data={data}  
  eventHandlers={{
    onClick: event => activity => {
      console.log({ event, activity });
      alert(JSON.stringify(activity, null, 4));
    },
    onMouseEnter: event => activity => console.log('mouseEnter'),
  }}
/>