Skip to content

Commit 1321c5c

Browse files
committed
chore: update story to use InView name
1 parent 2a79652 commit 1321c5c

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22
import { storiesOf } from '@storybook/react'
33
import { action } from '@storybook/addon-actions'
4-
import Observer from '../src/index'
4+
import InView from '../src/index'
55
import ScrollWrapper from './ScrollWrapper/index'
66
import RootComponent from './Root/index'
77
import { CSSProperties } from 'react'
@@ -34,74 +34,74 @@ const Header = React.forwardRef<any, Props>((props: Props, ref) => (
3434
storiesOf('Intersection Observer', module)
3535
.add('Basic', () => (
3636
<ScrollWrapper>
37-
<Observer onChange={action('Child Observer inview')}>
37+
<InView onChange={action('Child Observer inview')}>
3838
{({ inView, ref }) => (
3939
<Header ref={ref}>Header inside viewport: {inView.toString()}</Header>
4040
)}
41-
</Observer>
41+
</InView>
4242
</ScrollWrapper>
4343
))
4444
.add('Start in view', () => (
45-
<Observer onChange={action('Child Observer inview')}>
45+
<InView onChange={action('Child Observer inview')}>
4646
{({ inView, ref }) => (
4747
<Header ref={ref}>Header inside viewport: {inView.toString()}</Header>
4848
)}
49-
</Observer>
49+
</InView>
5050
))
5151
.add('Plain children', () => (
5252
<ScrollWrapper>
53-
<Observer onChange={action('Child Observer inview')}>
53+
<InView onChange={action('Child Observer inview')}>
5454
<Header>Plain children</Header>
55-
</Observer>
55+
</InView>
5656
</ScrollWrapper>
5757
))
5858
.add('Taller then viewport', () => (
5959
<ScrollWrapper>
60-
<Observer onChange={action('Child Observer inview')}>
60+
<InView onChange={action('Child Observer inview')}>
6161
{({ inView, ref }) => (
6262
<Header ref={ref} style={{ height: '150vh' }}>
6363
Header is inside the viewport: {inView.toString()}
6464
</Header>
6565
)}
66-
</Observer>
66+
</InView>
6767
</ScrollWrapper>
6868
))
6969
.add('With threshold 100%', () => (
7070
<ScrollWrapper>
71-
<Observer threshold={1} onChange={action('Child Observer inview')}>
71+
<InView threshold={1} onChange={action('Child Observer inview')}>
7272
{({ inView, ref }) => (
7373
<Header ref={ref}>
7474
Header is fully inside the viewport: {inView.toString()}
7575
</Header>
7676
)}
77-
</Observer>
77+
</InView>
7878
</ScrollWrapper>
7979
))
8080
.add('With threshold 50%', () => (
8181
<ScrollWrapper>
82-
<Observer threshold={0.5} onChange={action('Child Observer inview')}>
82+
<InView threshold={0.5} onChange={action('Child Observer inview')}>
8383
{({ inView, ref }) => (
8484
<Header ref={ref}>
8585
Header is 50% inside the viewport: {inView.toString()}
8686
</Header>
8787
)}
88-
</Observer>
88+
</InView>
8989
</ScrollWrapper>
9090
))
9191
.add('Taller then viewport with threshold 100%', () => (
9292
<ScrollWrapper>
93-
<Observer threshold={1}>
93+
<InView threshold={1}>
9494
{({ inView, ref }) => (
9595
<Header ref={ref} style={{ height: '150vh' }}>
9696
Header is fully inside the viewport: {inView.toString()}
9797
</Header>
9898
)}
99-
</Observer>
99+
</InView>
100100
</ScrollWrapper>
101101
))
102102
.add('With threshold array', () => (
103103
<ScrollWrapper>
104-
<Observer
104+
<InView
105105
threshold={[0, 0.25, 0.5, 0.75, 1]}
106106
onChange={action('Hit threshold trigger')}
107107
>
@@ -111,14 +111,14 @@ storiesOf('Intersection Observer', module)
111111
multiple times.
112112
</Header>
113113
)}
114-
</Observer>
114+
</InView>
115115
</ScrollWrapper>
116116
))
117117
.add('With root', () => (
118118
<RootComponent>
119119
{node => (
120120
<ScrollWrapper>
121-
<Observer
121+
<InView
122122
threshold={0}
123123
root={node}
124124
rootMargin="64px"
@@ -129,7 +129,7 @@ storiesOf('Intersection Observer', module)
129129
Header is inside the root viewport: {inView.toString()}
130130
</Header>
131131
)}
132-
</Observer>
132+
</InView>
133133
</ScrollWrapper>
134134
)}
135135
</RootComponent>
@@ -138,7 +138,7 @@ storiesOf('Intersection Observer', module)
138138
<RootComponent style={{ padding: 64 }}>
139139
{node => (
140140
<ScrollWrapper>
141-
<Observer
141+
<InView
142142
threshold={0}
143143
root={node}
144144
rootMargin="64px"
@@ -149,14 +149,14 @@ storiesOf('Intersection Observer', module)
149149
Header is inside the root viewport: {inView.toString()}
150150
</Header>
151151
)}
152-
</Observer>
152+
</InView>
153153
</ScrollWrapper>
154154
)}
155155
</RootComponent>
156156
))
157157
.add('Trigger once', () => (
158158
<ScrollWrapper>
159-
<Observer
159+
<InView
160160
threshold={1}
161161
triggerOnce
162162
onChange={action('Child Observer inview')}
@@ -166,24 +166,24 @@ storiesOf('Intersection Observer', module)
166166
Header was fully inside the viewport: {inView.toString()}
167167
</Header>
168168
)}
169-
</Observer>
169+
</InView>
170170
</ScrollWrapper>
171171
))
172172
.add('Multiple observers', () => (
173173
<ScrollWrapper>
174-
<Observer threshold={1} onChange={action('Child Observer inview')}>
174+
<InView threshold={1} onChange={action('Child Observer inview')}>
175175
{({ inView, ref }) => (
176176
<Header ref={ref}>
177177
Header 1 is fully inside the viewport: {inView.toString()}
178178
</Header>
179179
)}
180-
</Observer>
181-
<Observer threshold={1} onChange={action('Child Observer inview')}>
180+
</InView>
181+
<InView threshold={1} onChange={action('Child Observer inview')}>
182182
{({ inView, ref }) => (
183183
<Header ref={ref}>
184184
Header 2 is fully inside the viewport: {inView.toString()}
185185
</Header>
186186
)}
187-
</Observer>
187+
</InView>
188188
</ScrollWrapper>
189189
))

0 commit comments

Comments
 (0)