react-activity-calendar

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

MIT License

Downloads
27.6K
Stars
354
Committers
4

Bot releases are visible (Hide)

react-activity-calendar - Setting weekday label visibility individually

Published by grubersjoe about 2 months ago

The showWeekdayLabels prop not only takes a boolean but also a a list of ISO 8601 weekday for finer control which weekdays to show now: Story.

<ActivityCalendar data={data} showWeekdayLabels={['mon', 'fri']} />
react-activity-calendar - Added renderLegendBlock prop

Published by grubersjoe about 2 months ago

Added the renderColorLegend render prop to allow customizing how the color legend elements are rendered. For example, useful to add tooltips (compare the renderBlock prop): Story.

Thanks @AliceLeyou for the contribution!

<ActivityCalendar
  data={data}
  renderColorLegend={(block, level) => (
    <MuiTooltip title={`Level: ${level}`}>{block}</MuiTooltip>
  )}
/>
react-activity-calendar - Added ref prop

Published by grubersjoe about 2 months ago

Added a ref prop to allow access to the calendar DOM node.

const Component = () => {
  const calendarRef = useRef<HTMLElement>(null);

  return <ActivityCalendar data={data} ref={calendarRef} />;
}
react-activity-calendar - Arbitrary number of activity levels Latest Release

Published by grubersjoe 11 months ago

Added the maxLevel prop to support any number of activity levels: example. See issue #37 for context.

image

Thanks @eschreiner for the good idea šŸ‘.

react-activity-calendar - Improved styling on narrow screens

Published by grubersjoe 12 months ago

Instead of scaling the calendar down on narrow screens the container will overflow horizontally now. This follows what GitHub is doing on mobile devices. See issue #35 for details

react-activity-calendar - v2

Published by grubersjoe over 1 year ago

image

New

  • Added dark mode support āœØ
  • Added colorScheme prop šŸŒˆ
  • Added renderBlock prop to control how blocks are rendered šŸ§±
    This allows you to use all kinds of tooltip components.
  • The loading animation respects the prefers-reduced-motion: reduce setting now

Breaking changes

  • Removed the color prop
    Use theĀ themeĀ prop instead to set the calendar colors for the light and darkĀ system color scheme. By default, the calendar will use the currently set system color scheme, but you can enforce a specific color scheme with theĀ colorSchemeĀ prop. Define each color scaleĀ explicitlyĀ with five colors or pass exactly two colors (lowest and highest intensity) to calculate a single-hue scale. Colors can be specified in any valid CSS format. Theming example.
  • Removed exported utility function calculateTheme()
    Use the theme prop instead.
  • Removed the children prop
    Use the renderBlock prop instead.
  • Removed the dateFormat prop
    No longer necessary with renderBlock. If needed, you can format dates with any function.
  • Removed the labels.tooltip message
    No longer necessary with renderBlock. You can fully control what is rendered now.
  • Changed the default message for labels.totalCount
    {{count}} activities in {{year}} instead of {{count} contributions in {{year}}

Bugfixes

  • Fixed vertical alignment of SVG <text> nodes in Firefox
react-activity-calendar - Custom tooltip labels

Published by grubersjoe over 2 years ago

Thanks to @MarcioMeier a custom label can be set for the tooltip message now. The placeholders {{count}} and {{date}} are supported.

const labels = {
  tooltip: '<i>{{count}} views</i> on {{date}}'
};

<ActivityCalendar data={...} labels={labels} />
react-activity-calendar - Support for event handlers

Published by grubersjoe almost 3 years ago

You can register event handlers for the SVG <rect/> elements that are used to render the calendar days now. This way you can control the behaviour on click, hover, etc.

See https://grubersjoe.github.io/react-activity-calendar/?path=/story/activity-calendar--event-handlers.

react-activity-calendar - Localization for labels

Published by grubersjoe about 3 years ago

react-activity-calendar - Skeleton component

Published by grubersjoe about 3 years ago

A new Skeleton component is exported to show the loading state in a more convenient manner:

import Calendar, { Skeleton as CalendarSkeleton } from 'react-activity-calendar';

// ...

const render = loading ? <CalendarSkeleton loading /> : <Calendar data={data} />;

Of course you still can use the loading property of the calendar component directly. However, the calendar requires the data property.

react-activity-calendar - First release

Published by grubersjoe over 3 years ago

This component was extracted from grubersjoe/react-github-calendar to improve reusability. I hope it is useful for someone :).

Package Rankings
Top 2.91% on Npmjs.org
Badges
Extracted from project README
CI
Related Projects