From be75361e4be3e2fa90d557e9e3913e1b95baf9b9 Mon Sep 17 00:00:00 2001
From: Jonathan Gruber
Date: Fri, 24 Nov 2023 19:57:38 +0100
Subject: [PATCH] Rearrange and rename stories
---
src/component/ActivityCalendar.stories.tsx | 270 +++++++++++----------
1 file changed, 146 insertions(+), 124 deletions(-)
diff --git a/src/component/ActivityCalendar.stories.tsx b/src/component/ActivityCalendar.stories.tsx
index d35e939..1cf86f5 100644
--- a/src/component/ActivityCalendar.stories.tsx
+++ b/src/component/ActivityCalendar.stories.tsx
@@ -1,25 +1,25 @@
-import { Tooltip as MuiTooltip } from '@mui/material';
-import LinkTo from '@storybook/addon-links/react';
-import { Source as StorybookSource } from '@storybook/blocks';
-import { Meta, StoryObj } from '@storybook/react';
-import React, { cloneElement } from 'react';
-import { Tooltip as ReactTooltip } from 'react-tooltip';
-import 'react-tooltip/dist/react-tooltip.css';
-import { useDarkMode } from 'storybook-dark-mode';
+import { Tooltip as MuiTooltip } from "@mui/material";
+import LinkTo from "@storybook/addon-links/react";
+import { Source as StorybookSource } from "@storybook/blocks";
+import { Meta, StoryObj } from "@storybook/react";
+import React, { cloneElement } from "react";
+import { Tooltip as ReactTooltip } from "react-tooltip";
+import "react-tooltip/dist/react-tooltip.css";
+import { useDarkMode } from "storybook-dark-mode";
-import Container from '../../.storybook/components/Container';
-import exampleCustomized from '../../examples/customization?raw';
-import exampleEventHandlersInterface from '../../examples/event-handlers-type?raw';
-import exampleEventHandlers from '../../examples/event-handlers?raw';
-import exampleLabelsShape from '../../examples/labels-shape?raw';
-import exampleLabels from '../../examples/labels?raw';
-import exampleThemeExplicit from '../../examples/themes-explicit?raw';
-import exampleTheme from '../../examples/themes?raw';
-import exampleTooltipsMui from '../../examples/tooltips-mui?raw';
-import exampleTooltipsReact from '../../examples/tooltips-react?raw';
-import { Theme } from '../types';
-import { generateData } from '../utils/calendar';
-import ActivityCalendar, { Props } from './ActivityCalendar';
+import Container from "../../.storybook/components/Container";
+import exampleCustomization from "../../examples/customization?raw";
+import exampleEventHandlersInterface from "../../examples/event-handlers-type?raw";
+import exampleEventHandlers from "../../examples/event-handlers?raw";
+import exampleLabelsShape from "../../examples/labels-shape?raw";
+import exampleLabels from "../../examples/labels?raw";
+import exampleThemeExplicit from "../../examples/themes-explicit?raw";
+import exampleTheme from "../../examples/themes?raw";
+import exampleTooltipsMui from "../../examples/tooltips-mui?raw";
+import exampleTooltipsReact from "../../examples/tooltips-react?raw";
+import { Theme } from "../types";
+import { generateData } from "../utils/calendar";
+import ActivityCalendar, { Props } from "./ActivityCalendar";
type Story = StoryObj;
@@ -130,7 +130,7 @@ export const Loading: Story = {
},
};
-export const WithSpecificLevelRange: Story = {
+export const ActivityLevels: Story = {
args: {
...defaultProps,
maxLevel: 2,
@@ -149,9 +149,10 @@ export const WithSpecificLevelRange: Story = {
maxLevel{' '}
- property to set the maximum activity level (zero indexed).
-
- If set, each passed activity level must be in the interval from 0 to maxLevel.
+ prop to control the number of activity levels. This value is zero indexed (0 represents no
+ activity), so for example a maxLevel of 2 will result in 3 levels as
+ above. If set, each activity level must be in the interval from 0 to{' '}
+ maxLevel.
- Use the theme prop to set the calendar colors for the light and dark system{' '}
+ Use the{' '}
+
+ theme
+ {' '}
+ prop to configure the calendar colors for the light and dark system{' '}
color scheme.
Define each color scale{' '}
-
+
explicitly
{' '}
- with five colors or pass exactly two colors (the lowest and highest intensity) to calculate
- a single-hue scale. Colors can be specified in any valid CSS format.
+ by settings all colors (5 per default) or pass exactly two colors (the lowest and highest
+ intensity) to calculate a single-hue scale. For explicit themes the color count must match
+ the number of activity levels, which is controlled by the{' '}
+
+ maxLevel
+ {' '}
+ prop. Colors can be specified in any valid CSS format.
The colors for at least one scheme must be set. If undefined, the default theme is used. By
@@ -234,7 +285,7 @@ export const WithTheme: Story = {
),
};
-export const WithExplicitTheme: Story = {
+export const ExplicitThemes: Story = {
args: {
...defaultProps,
theme: explicitTheme,
@@ -254,7 +305,7 @@ export const WithExplicitTheme: Story = {
+ You can register event handlers for the SVG <rect/> elements that are
+ used to render the calendar days. This way you can control the behaviour on click, hover,
+ etc. All event listeners have the following signature, so you can use the activity data of
+ the block inside the handler:
+
- You can register event handlers for the SVG <rect/> elements that are
- used to render the calendar days. This way you can control the behaviour on click, hover,
- etc. All event listeners have the following signature, so you can use the activity data of
- the block inside the handler:
-