Skip to content

Commit 21c8332

Browse files
committed
Update documentation to display animation props
1 parent d4c50c4 commit 21c8332

File tree

6 files changed

+31
-53
lines changed

6 files changed

+31
-53
lines changed

POST.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/components/CompositeCurve/CompositeCurve.stories.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ const meta: Meta<typeof CompositeCurve> = {
2727
color: { control: { type: 'color' } },
2828
opacity: { control: { type: 'range', min: 0, max: 1, step: 0.1 } },
2929
lineWidth: { control: { type: 'range', min: 0.1, max: 4, step: 0.1 } },
30-
resolutionFactor: { control: { type: 'range', min: 1, max: 50, step: 0.5 } }
30+
resolutionFactor: {
31+
control: { type: 'range', min: 1, max: 50, step: 0.5 }
32+
},
33+
animate: { control: { type: 'boolean' } },
34+
easing: {
35+
control: { type: 'select' },
36+
options: ['linear', 'easeIn', 'easeOut', 'easeInOut', 'elastic', 'bounce']
37+
},
38+
duration: { control: { type: 'range', min: 0, max: 1000, step: 50 } }
3139
}
3240
}
3341
export default meta

src/components/FilterCurve/FilterCurve.stories.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ const meta: Meta<typeof FilterCurve> = {
3131
activeLineWidth: {
3232
control: { type: 'range', min: 0.1, max: 4, step: 0.1 }
3333
},
34+
resolutionFactor: {
35+
control: { type: 'range', min: 1, max: 50, step: 0.5 }
36+
},
3437
animate: { control: { type: 'boolean' } },
3538
easing: {
3639
control: { type: 'select' },
37-
options: ['linear', 'easeIn', 'easeOut', 'easeInOut', 'elastic']
40+
options: ['linear', 'easeIn', 'easeOut', 'easeInOut', 'elastic', 'bounce']
3841
},
3942
duration: { control: { type: 'range', min: 0, max: 1000, step: 50 } }
4043
}

src/components/FrequencyResponseCurve/FrequencyResponseCurve.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const meta: Meta<typeof FrequencyResponseCurve> = {
3131
animate: { control: { type: 'boolean' } },
3232
easing: {
3333
control: { type: 'select' },
34-
options: ['linear', 'easeIn', 'easeOut', 'easeInOut', 'elastic']
34+
options: ['linear', 'easeIn', 'easeOut', 'easeInOut', 'elastic', 'bounce']
3535
},
3636
duration: { control: { type: 'range', min: 0, max: 1000, step: 50 } }
3737
}

src/components/FrequencyResponseGraph/GraphProvider.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import type React from 'react'
4-
import { createContext } from 'react'
4+
import { createContext, useMemo } from 'react'
55

66
import {
77
type GraphScale,
@@ -39,14 +39,22 @@ export const GraphProvider = ({
3939
width: number
4040
logScale: LogScaleFunction
4141
}) => {
42-
const contextValue = {
43-
svgRef,
44-
theme,
45-
scale,
46-
logScale,
47-
height,
48-
width
49-
}
42+
// Memoize theme and scale separately to catch actual value changes
43+
const memoizedTheme = useMemo(() => theme, [JSON.stringify(theme)])
44+
45+
const memoizedScale = useMemo(() => scale, [JSON.stringify(scale)])
46+
47+
const contextValue = useMemo(
48+
() => ({
49+
svgRef,
50+
theme: memoizedTheme,
51+
scale: memoizedScale,
52+
logScale,
53+
height,
54+
width
55+
}),
56+
[svgRef, memoizedTheme, memoizedScale, logScale, height, width]
57+
)
5058

5159
return (
5260
<GraphContext.Provider value={contextValue}>

src/docs/Roadmap.docs.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { Meta } from '@storybook/blocks'
1616
## Next
1717

1818
- Add stepped / discrete frequency curve variant
19-
- Add SVG animations and transitions to filter components
2019
- Add more biquad filter functions, refine unit-tests
2120
- Make context/provider API more generalised and open it for third-party use
2221

0 commit comments

Comments
 (0)