mirror of
https://github.com/streamich/react-use.git
synced 2026-02-01 14:37:31 +00:00
chore: clean tsconfig.json; feat: updated webpack config to export a function to achieve full-control mode, instead of deprecated Extend Mode;
30 lines
948 B
TypeScript
30 lines
948 B
TypeScript
import { withKnobs } from '@storybook/addon-knobs';
|
|
import { storiesOf } from '@storybook/react';
|
|
import React from 'react';
|
|
import { createBreakpoint } from '../src';
|
|
import ShowDocs from './util/ShowDocs';
|
|
|
|
const useBreakpointA = createBreakpoint();
|
|
const useBreakpointB = createBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 });
|
|
|
|
const Demo = () => {
|
|
const breakpointA = useBreakpointA();
|
|
const breakpointB = useBreakpointB();
|
|
return (
|
|
<div>
|
|
<p>{'try resize your window'}</p>
|
|
<p>{'createBreakpoint() #default : { laptopL: 1440, laptop: 1024, tablet: 768 }'}</p>
|
|
<p>{breakpointA}</p>
|
|
<p>{'createBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 })'}</p>
|
|
<p>{breakpointB}</p>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
storiesOf('sensors|createBreakpoint', module)
|
|
.addDecorator(withKnobs)
|
|
.add('Docs', () => <ShowDocs md={require('../docs/createBreakpoint.md')} />)
|
|
.add('Demo', () => {
|
|
return <Demo />;
|
|
});
|