File tree Expand file tree Collapse file tree 2 files changed +94
-1
lines changed Expand file tree Collapse file tree 2 files changed +94
-1
lines changed Original file line number Diff line number Diff line change 1717}
1818
1919:local(.bannerBg ) {
20- background : #333 ;
20+ background : #fff ;
21+ }
22+
23+ :local(.customChild ) {
24+ position : absolute ;
25+ top : 0 ;
26+ left : 0 ;
27+ right : 0 ;
28+ bottom : 0 ;
29+ text-align : center ;
30+ }
31+
32+ :local(.red ) {
33+ background-color : rgba (#f74c36 , 0.8 );
34+ }
35+
36+ :local(.green ) {
37+ background-color : rgba (#35f783 , 0.8 );
38+ }
39+
40+ :local(.blue ) {
41+ background-color : rgba (#42a7f4 , 0.8 );
42+ }
43+
44+ :local(.video ) {
45+ width : 100% ;
46+ height : 100% ;
47+ object-fit : cover ;
2148}
Original file line number Diff line number Diff line change @@ -81,6 +81,72 @@ storiesOf('<ParallaxBanner>', module)
8181 />
8282 ) ;
8383 } )
84+ . add ( 'with a video' , ( ) => (
85+ < ParallaxBanner
86+ className = { styles . bannerBg }
87+ layers = { [
88+ {
89+ amount : 0.3 ,
90+ children : (
91+ < video
92+ className = { styles . video }
93+ autoPlay
94+ loop
95+ playsInline
96+ preload = "auto"
97+ muted
98+ poster = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/boats-at-sea.jpg"
99+ src = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/boats-at-sea-720.mp4"
100+ />
101+ ) ,
102+ slowerScrollRate : true ,
103+ } ,
104+ ] }
105+ >
106+ < div className = { styles . parallaxChildren } >
107+ < h1 > Video Background</ h1 >
108+ </ div >
109+ </ ParallaxBanner >
110+ ) )
111+ . add ( 'with custom layer children' , ( ) => (
112+ < ParallaxBanner
113+ className = { styles . bannerBg }
114+ layers = { [
115+ {
116+ children : (
117+ < div className = { `${ styles . customChild } ${ styles . red } ` } >
118+ Red
119+ </ div >
120+ ) ,
121+ amount : 0.2 ,
122+ expanded : false ,
123+ slowerScrollRate : false ,
124+ } ,
125+ {
126+ children : (
127+ < div
128+ className = { `${ styles . customChild } ${ styles . green } ` }
129+ >
130+ Green
131+ </ div >
132+ ) ,
133+ amount : 0.4 ,
134+ expanded : false ,
135+ slowerScrollRate : false ,
136+ } ,
137+ {
138+ children : (
139+ < div className = { `${ styles . customChild } ${ styles . blue } ` } >
140+ Blue
141+ </ div >
142+ ) ,
143+ amount : 0.6 ,
144+ expanded : false ,
145+ slowerScrollRate : false ,
146+ } ,
147+ ] }
148+ />
149+ ) )
84150 . add ( 'with parallax disabled' , ( ) => (
85151 < ParallaxBanner
86152 className = { styles . bannerBg }
You can’t perform that action at this time.
0 commit comments