|
1 | 1 | import React from 'react';
|
2 | | -import { useParallax } from '../../src'; |
| 2 | +import { ParallaxProps,useParallax } from '../../src'; |
3 | 3 | import { Element } from '../Element/Element';
|
4 | 4 | import { Container } from '../Container';
|
5 | 5 | import styles from '../Parallax/Parallax.module.css';
|
6 | 6 |
|
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) { |
13 | 8 | const { ref } = useParallax<HTMLDivElement>(props);
|
14 | 9 |
|
15 | 10 | return (
|
16 | 11 | <div className={styles.parallax} ref={ref}>
|
17 | 12 | <Element name="A" />
|
18 | 13 | </div>
|
19 | 14 | );
|
| 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} />; |
20 | 23 | };
|
21 | 24 |
|
22 | 25 | export const WithRotation = Template.bind({});
|
|
0 commit comments