File size: 639 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import { action } from '@storybook/addon-actions';
import { storiesOf } from '@storybook/react';
import * as React from 'react';
import { useRef } from 'react';
import { useClickAway } from '../src';
import ShowDocs from './util/ShowDocs';
const Demo = () => {
const ref = useRef(null);
useClickAway<MouseEvent>(ref, action('outside clicked'));
return (
<div
ref={ref}
style={{
width: 200,
height: 200,
background: 'red',
}}
/>
);
};
storiesOf('UI/useClickAway', module)
.add('Docs', () => <ShowDocs md={require('../docs/useClickAway.md')} />)
.add('Demo', () => <Demo />);
|