11import React from 'react' ;
22import { text , number } from '@storybook/addon-knobs' ;
33import { storiesOf } from '@storybook/react' ;
4- import { Parallax , ParallaxProvider } from 'react-scroll-parallax' ;
4+ import { Parallax } from 'react-scroll-parallax' ;
55import Element from '../Element/Element' ;
66import ScrollContainer from '../ScrollContainer' ;
77import styles from './Parallax.scss' ;
@@ -16,29 +16,25 @@ storiesOf('<Parallax> in a <div>', module)
1616 const elements = new Array ( amount * 2 + 1 ) . fill ( null ) . map ( ( x , i ) => i ) ;
1717 return (
1818 < ScrollContainer >
19- { scrollContainer => (
20- < ParallaxProvider scrollContainer = { scrollContainer } >
21- < div className = "vertical" >
22- < div className = "elements linear" >
23- { elements . map ( ( _ , i ) => {
24- const n = i - amount ;
25- return (
26- < Parallax
27- key = { n }
28- className = { styles . smallLinear }
29- x = { [
30- `${ offA * n } ${ unit } ` ,
31- `${ offB * n } ${ unit } ` ,
32- ] }
33- >
34- < Element name = { n * - 1 } />
35- </ Parallax >
36- ) ;
37- } ) }
38- </ div >
39- </ div >
40- </ ParallaxProvider >
41- ) }
19+ < div className = "vertical" >
20+ < div className = "elements linear" >
21+ { elements . map ( ( _ , i ) => {
22+ const n = i - amount ;
23+ return (
24+ < Parallax
25+ key = { n }
26+ className = { styles . smallLinear }
27+ x = { [
28+ `${ offA * n } ${ unit } ` ,
29+ `${ offB * n } ${ unit } ` ,
30+ ] }
31+ >
32+ < Element name = { n * - 1 } />
33+ </ Parallax >
34+ ) ;
35+ } ) }
36+ </ div >
37+ </ div >
4238 </ ScrollContainer >
4339 ) ;
4440 } )
@@ -50,29 +46,25 @@ storiesOf('<Parallax> in a <div>', module)
5046 const elements = new Array ( amount * 2 + 1 ) . fill ( null ) . map ( ( x , i ) => i ) ;
5147 return (
5248 < ScrollContainer >
53- { scrollContainer => (
54- < ParallaxProvider scrollContainer = { scrollContainer } >
55- < div className = "vertical" >
56- < div className = "elements linear" >
57- { elements . map ( ( _ , i ) => {
58- const n = i - amount ;
59- return (
60- < Parallax
61- key = { n }
62- className = { styles . smallLinear }
63- y = { [
64- `${ offA * n } ${ unit } ` ,
65- `${ offB * n } ${ unit } ` ,
66- ] }
67- >
68- < Element name = { n * - 1 } />
69- </ Parallax >
70- ) ;
71- } ) }
72- </ div >
73- </ div >
74- </ ParallaxProvider >
75- ) }
49+ < div className = "vertical" >
50+ < div className = "elements linear" >
51+ { elements . map ( ( _ , i ) => {
52+ const n = i - amount ;
53+ return (
54+ < Parallax
55+ key = { n }
56+ className = { styles . smallLinear }
57+ y = { [
58+ `${ offA * n } ${ unit } ` ,
59+ `${ offB * n } ${ unit } ` ,
60+ ] }
61+ >
62+ < Element name = { n * - 1 } />
63+ </ Parallax >
64+ ) ;
65+ } ) }
66+ </ div >
67+ </ div >
7668 </ ScrollContainer >
7769 ) ;
7870 } )
@@ -83,33 +75,26 @@ storiesOf('<Parallax> in a <div>', module)
8375 const unit = text ( 'Offset Unit' , '%' ) ;
8476 const elements = new Array ( amount * 2 + 1 ) . fill ( null ) . map ( ( x , i ) => i ) ;
8577 return (
86- < ScrollContainer >
87- { scrollContainer => (
88- < ParallaxProvider
89- scrollContainer = { scrollContainer }
90- scrollAxis = "horizontal"
91- >
92- < div className = "horizontal" >
93- < div className = "elements linear" >
94- { elements . map ( ( _ , i ) => {
95- const n = i - amount ;
96- return (
97- < Parallax
98- key = { n }
99- className = { styles . smallLinear }
100- x = { [
101- `${ offA * n } ${ unit } ` ,
102- `${ offB * n } ${ unit } ` ,
103- ] }
104- >
105- < Element name = { n * - 1 } />
106- </ Parallax >
107- ) ;
108- } ) }
109- </ div >
110- </ div >
111- </ ParallaxProvider >
112- ) }
78+ < ScrollContainer scrollAxis = "horizontal" >
79+ < div className = "horizontal" >
80+ < div className = "elements linear" >
81+ { elements . map ( ( _ , i ) => {
82+ const n = i - amount ;
83+ return (
84+ < Parallax
85+ key = { n }
86+ className = { styles . smallLinear }
87+ x = { [
88+ `${ offA * n } ${ unit } ` ,
89+ `${ offB * n } ${ unit } ` ,
90+ ] }
91+ >
92+ < Element name = { n * - 1 } />
93+ </ Parallax >
94+ ) ;
95+ } ) }
96+ </ div >
97+ </ div >
11398 </ ScrollContainer >
11499 ) ;
115100 } )
@@ -120,33 +105,26 @@ storiesOf('<Parallax> in a <div>', module)
120105 const unit = text ( 'Offset Unit' , '%' ) ;
121106 const elements = new Array ( amount * 2 + 1 ) . fill ( null ) . map ( ( x , i ) => i ) ;
122107 return (
123- < ScrollContainer >
124- { scrollContainer => (
125- < ParallaxProvider
126- scrollContainer = { scrollContainer }
127- scrollAxis = "horizontal"
128- >
129- < div className = "horizontal" >
130- < div className = "elements linear" >
131- { elements . map ( ( _ , i ) => {
132- const n = i - amount ;
133- return (
134- < Parallax
135- key = { n }
136- className = { styles . smallLinear }
137- y = { [
138- `${ offA * n } ${ unit } ` ,
139- `${ offB * n } ${ unit } ` ,
140- ] }
141- >
142- < Element name = { n * - 1 } />
143- </ Parallax >
144- ) ;
145- } ) }
146- </ div >
147- </ div >
148- </ ParallaxProvider >
149- ) }
108+ < ScrollContainer scrollAxis = "horizontal" >
109+ < div className = "horizontal" >
110+ < div className = "elements linear" >
111+ { elements . map ( ( _ , i ) => {
112+ const n = i - amount ;
113+ return (
114+ < Parallax
115+ key = { n }
116+ className = { styles . smallLinear }
117+ y = { [
118+ `${ offA * n } ${ unit } ` ,
119+ `${ offB * n } ${ unit } ` ,
120+ ] }
121+ >
122+ < Element name = { n * - 1 } />
123+ </ Parallax >
124+ ) ;
125+ } ) }
126+ </ div >
127+ </ div >
150128 </ ScrollContainer >
151129 ) ;
152130 } ) ;
0 commit comments