react-use/stories/useSize.story.tsx
Anton Zinovyev 2832b7a37e
chore: move all stories from src directory. (#715)
chore: clean tsconfig.json;

feat: updated webpack config to export a function to achieve full-control mode, instead of deprecated Extend Mode;
2019-12-09 23:36:40 +03:00

22 lines
565 B
TypeScript

import { storiesOf } from '@storybook/react';
import * as React from 'react';
import { useSize } from '../src';
import ShowDocs from './util/ShowDocs';
const Demo = () => {
const [sized, state] = useSize(({ width: currentWidth }) => (
<div style={{ background: 'red' }}>Size me up! ({currentWidth}px)</div>
));
return (
<div>
<pre>{JSON.stringify(state, null, 2)}</pre>
{sized}
</div>
);
};
storiesOf('Sensors|useSize', module)
.add('Docs', () => <ShowDocs md={require('../docs/useSize.md')} />)
.add('Demo', () => <Demo />);