-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James
committed
Jun 17, 2019
1 parent
25a93f6
commit 760edf1
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { storiesOf } from '@storybook/react'; | ||
import * as React from 'react'; | ||
import { useScrolling } from '..'; | ||
import ShowDocs from './util/ShowDocs'; | ||
|
||
const Demo = () => { | ||
const scrollRef = React.useRef(null); | ||
const scrolling = useScrolling(scrollRef); | ||
|
||
return ( | ||
<> | ||
{<div>{scrolling ? 'Scrolling' : 'Not scrolling'}</div>} | ||
<br /> | ||
<div | ||
ref={scrollRef} | ||
style={{ | ||
width: '400px', | ||
height: '400px', | ||
backgroundColor: 'whitesmoke', | ||
overflow: 'scroll', | ||
}} | ||
> | ||
<div style={{ width: '2000px', height: '2000px' }}>Scroll me</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
storiesOf('Sensors/useScrolling', module) | ||
.add('Docs', () => <ShowDocs md={require('../../docs/useScrolling.md')} />) | ||
.add('Demo', () => <Demo />); |