Skip to content

Commit

Permalink
feat: add useScrolling story
Browse files Browse the repository at this point in the history
  • Loading branch information
James committed Jun 17, 2019
1 parent 25a93f6 commit 760edf1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/__stories__/useScrolling.story.tsx
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 />);

0 comments on commit 760edf1

Please sign in to comment.