import React from 'react'
import { type Meta } from '@storybook/react-vite'
import { lineAnimationDelay } from '../../services/GraphHelperServiceTyped'
import { DocsTemplate } from '../../../.storybook'
export const Example = (args: { length: number }): React.JSX.Element => {
const { length } = args
const result = lineAnimationDelay(length)
return (
<>
Input Length: {length}
Animation Delay: {result}ms
>
)
}
Example.storyName = 'lineAnimationDelay'
Example.args = {
length: 10,
}
export default {
title: 'Helper Functions/lineAnimationDelay',
component: Example,
argTypes: {
length: {
control: 'number',
description:
'The number of data points to determine the animation delay.',
},
},
parameters: {
viewMode: 'docs',
previewTabs: {
canvas: { hidden: true },
},
docs: {
page: () => (
<>
lineAnimationDelay is used to calculate the delay
for line graph animations based on the dataset size.
,
The function takes one argument:
-
length: The number of data points in the graph.
,
Returns the delay in milliseconds:
- 800 if the length is greater than 20.
-
600 if the length is greater than 4 but less than or equal
to 20.
,
]}
/>
>
),
},
},
} as Meta