mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
chore: 🤖 improve build and Storybook setup
This commit is contained in:
parent
3091823ea9
commit
6598c19e98
@ -1,6 +1,6 @@
|
||||
import {configure} from '@storybook/react';
|
||||
|
||||
const req = require.context('../src/stories/', true, /.*\.(stories|story)\.(js|jsx|ts|tsx)?$/);
|
||||
const req = require.context('../src/__stories__/', true, /.*\.(stories|story)\.(js|jsx|ts|tsx)?$/);
|
||||
|
||||
const loadStories = () => {
|
||||
req.keys().forEach((filename) => req(filename));
|
||||
|
||||
@ -3,12 +3,14 @@ import {storiesOf} from '@storybook/react';
|
||||
import {useToggle} from '..';
|
||||
|
||||
const Demo = () => {
|
||||
const [on, toggle] = useToggle(true);
|
||||
const [on, toggle, set] = useToggle(true);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>{on ? 'ON' : 'OFF'}</div>
|
||||
<button onClick={toggle}>Toggle</button>
|
||||
<button onClick={() => set(true)}>set ON</button>
|
||||
<button onClick={() => set(false)}>set OFF</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@ -7,7 +7,7 @@
|
||||
"declaration": true,
|
||||
"pretty": true,
|
||||
"rootDir": "src",
|
||||
"sourceMap": true,
|
||||
"sourceMap": false,
|
||||
"strict": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
@ -16,5 +16,13 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"outDir": "lib",
|
||||
"lib": ["es2018", "dom"]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"lib",
|
||||
"**/__tests__/**/*",
|
||||
"**/__stories__/**/*",
|
||||
"*.test.ts",
|
||||
"*.test.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user