Skip to content

Commit 08408b1

Browse files
committed
banner doc update
1 parent c9c5ee2 commit 08408b1

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

docs/parallax-banner-component.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,68 @@
22

33
Component that utilizes `<Parallax>` components to achieve a parallaxing banner effect. Allows a single or multiple images to be parallaxed at different rates within the banner area.
44

5-
## Banner Usage
5+
## Basic Example
66

7-
Use the `layers` prop to indicate all images, offset amounts, and scroll rates. Optionally pass additional children to be rendered. Styles of the outermost banner element can also be changed. Here's an example:
7+
Use the `layers` to supply a `speed` and `image` to your banner. In this case, it will create a banner using a single image, that moves slower than the rate of scroll, and the edges of the image will never be visible.
8+
9+
**NOTE:** You MUST add a `height` value either as a `style` or through a `className` otherwise the banner will have no height and be hidden.
10+
11+
```jsx
12+
<ParallaxBanner
13+
layers={[
14+
{
15+
image: 'https://foo.com/foo.jpg',
16+
speed: -20,
17+
},
18+
]}
19+
style={{
20+
height: '500px',
21+
}}
22+
/>
23+
```
24+
25+
## Multiple Layers
26+
27+
Supply the `layers` prop with additional configuration for more images. Each layer can contain unique configurations.
828

929
```jsx
1030
<ParallaxBanner
11-
className="your-class"
1231
layers={[
1332
{
1433
image: 'https://foo.com/foo.jpg',
15-
speed: 0.1,
34+
speed: -20,
1635
},
1736
{
1837
image: 'https://foo.com/bar.png',
19-
speed: 0.2,
38+
speed: -10,
39+
},
40+
]}
41+
style={{
42+
height: '500px',
43+
}}
44+
/>
45+
```
46+
47+
## Customized Layers
48+
49+
Supply the `layers` prop with additional configuration for more images. Each layer can contain unique configurations.
50+
51+
```jsx
52+
<ParallaxBanner
53+
layers={[
54+
{
55+
image: 'https://foo.com/foo.jpg',
56+
speed: -20,
57+
},
58+
{
59+
children: <h1>My Headline</h1>,
60+
speed: -10,
2061
},
2162
]}
2263
style={{
2364
height: '500px',
2465
}}
25-
>
26-
<h1>Banner Children</h1>
27-
</ParallaxBanner>
66+
/>
2867
```
2968

3069
## Props

0 commit comments

Comments
 (0)