Skip to content

Commit 16e4462

Browse files
authored
fix: useParallax stories (#283)
1 parent 3a9b8ef commit 16e4462

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

stories/useParallax/useParallax.stories.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
import React from 'react';
2-
import { useParallax } from '../../src';
2+
import { ParallaxProps, useParallax } from '../../src';
33
import { Element } from '../Element/Element';
44
import { Container } from '../Container';
55
import styles from '../Parallax/Parallax.module.css';
66

7-
const Template = (args) => {
8-
const props = Object.entries(args).reduce((acc: any, entry: any) => {
9-
acc[entry[0]] = entry[1].split(',');
10-
return acc;
11-
}, {} as any);
12-
7+
function ElementWithHook(props: ParallaxProps) {
138
const { ref } = useParallax<HTMLDivElement>(props);
149

1510
return (
1611
<div className={styles.parallax} ref={ref}>
1712
<Element name="A" />
1813
</div>
1914
);
15+
}
16+
17+
const Template = (args) => {
18+
const props = Object.entries(args).reduce((acc: any, entry: any) => {
19+
acc[entry[0]] = entry[1].split(',');
20+
return acc;
21+
}, {} as any);
22+
return <ElementWithHook {...props} />;
2023
};
2124

2225
export const WithRotation = Template.bind({});

0 commit comments

Comments
 (0)