import { storiesOf } from '@storybook/react'; import * as React from 'react'; import { useIntersection } from '../src'; import ShowDocs from './util/ShowDocs'; const Spacer = () => (
); const Demo = () => { const intersectionRef = React.useRef(null); const intersection = useIntersection(intersectionRef, { root: null, rootMargin: '0px', threshold: 1, }); return (
Scroll me
{intersection && intersection.intersectionRatio < 1 ? 'Obscured' : 'Fully in view'}
); }; storiesOf('Sensors/useIntersection', module) .add('Docs', () => ) .add('Demo', () => );