Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7085a97

Browse files
parallax banner stories
1 parent 784afa8 commit 7085a97

File tree

3 files changed

+141
-1
lines changed

3 files changed

+141
-1
lines changed

‎stories/Parallax/Parallax.stories.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ storiesOf('<Parallax>', module)
5252
</Parallax>
5353
</div>
5454
))
55-
.add('on a 100 elements', () => {
55+
.add('with a 100 elements', () => {
5656
const amount = number('Number of Elements', 100);
5757
const offset = number('Offset %', 50);
5858
const elements = new Array(amount).fill(null).map((x, i) => i);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
:local(.parallaxChildren) {
2+
position: absolute;
3+
top: 0;
4+
left: 0;
5+
right: 0;
6+
bottom: 0;
7+
display: flex;
8+
flex-flow: row wrap;
9+
align-items: center;
10+
justify-content: center;
11+
12+
h1 {
13+
color: white;
14+
font-size: 4vw;
15+
font-weight: normal;
16+
}
17+
}
18+
19+
:local(.bannerBg) {
20+
background: #333;
21+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import React from 'react';
2+
import {
3+
withKnobs,
4+
text,
5+
boolean,
6+
number,
7+
array,
8+
} from '@storybook/addon-knobs';
9+
import { storiesOf } from '@storybook/react';
10+
import { ParallaxBanner } from 'react-scroll-parallax';
11+
import styles from './ParallaxBanner.scss';
12+
import '../styles.scss';
13+
14+
storiesOf('<ParallaxBanner>', module)
15+
.add('with a full page background', () => (
16+
<ParallaxBanner
17+
style={{
18+
height: '100vh',
19+
}}
20+
className={styles.bannerBg}
21+
layers={[
22+
{
23+
image:
24+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/banner.jpg',
25+
amount: 0.2,
26+
slowerScrollRate: false,
27+
},
28+
]}
29+
/>
30+
))
31+
.add('with a single background', () => (
32+
<ParallaxBanner
33+
className={styles.bannerBg}
34+
layers={[
35+
{
36+
image:
37+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/banner.jpg',
38+
amount: 0.2,
39+
slowerScrollRate: false,
40+
},
41+
]}
42+
/>
43+
))
44+
.add('with a background and children', () => (
45+
<ParallaxBanner
46+
className={styles.bannerBg}
47+
layers={[
48+
{
49+
image:
50+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/banner.jpg',
51+
amount: 0.2,
52+
slowerScrollRate: false,
53+
},
54+
]}
55+
>
56+
<div className={styles.parallaxChildren}>
57+
<h1>Headline Text</h1>
58+
</div>
59+
</ParallaxBanner>
60+
))
61+
.add('with parallax disabled', () => (
62+
<ParallaxBanner
63+
className={styles.bannerBg}
64+
disabled
65+
layers={[
66+
{
67+
image:
68+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/banner.jpg',
69+
amount: 0.2,
70+
slowerScrollRate: false,
71+
},
72+
]}
73+
>
74+
<div className={styles.parallaxChildren}>
75+
<h1>Disabled Parallax</h1>
76+
</div>
77+
</ParallaxBanner>
78+
))
79+
.add('with multiple backgrounds', () => {
80+
const layers = [
81+
{
82+
image:
83+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/parallax-background-1.png',
84+
amount: 0,
85+
slowerScrollRate: false,
86+
},
87+
{
88+
image:
89+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/parallax-background-2.png',
90+
amount: 0.1,
91+
slowerScrollRate: false,
92+
},
93+
{
94+
image:
95+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/parallax-background-3.png',
96+
amount: 0.2,
97+
slowerScrollRate: false,
98+
},
99+
{
100+
image:
101+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/parallax-background-4.png',
102+
amount: 0.3,
103+
slowerScrollRate: false,
104+
},
105+
{
106+
image:
107+
'https://s3-us-west-2.amazonaws.com/s.cdpn.io/105988/parallax-background-5.png',
108+
amount: 0.4,
109+
slowerScrollRate: false,
110+
},
111+
];
112+
return (
113+
<ParallaxBanner
114+
className={styles.bannerBg}
115+
layers={layers}
116+
style={{ height: '50vh' }}
117+
/>
118+
);
119+
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /