forked from rebassjs/rebass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
57 lines (48 loc) · 1.07 KB
/
config.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from 'react'
import { configure, addDecorator } from '@storybook/react'
import { setOptions } from '@storybook/addon-options'
import { injectGlobal } from 'styled-components'
import { Box } from 'grid-styled'
import { createProvider } from 'refunk'
import XRay from 'react-x-ray'
import Provider from '../src/Provider'
injectGlobal([], {
'*': {
boxSizing: 'border-box'
},
body: {
lineHeight: 1.5,
margin: 0
}
})
const hoc = createProvider({
xray: false
})
const toggleXRay = state => ({ xray: !state.xray })
const Demo = hoc(props => (
<Provider>
<XRay disabled={!props.xray}>
<Box p={3}>
{props.story()}
</Box>
</XRay>
<button
onClick={e => props.update(toggleXRay)}
children='X-Ray'
/>
</Provider>
))
addDecorator(story => (
<Demo story={story} />
))
setOptions({
name: 'Rebass',
url: 'http://jxnblk.com/rebass',
showDownPanel: false,
})
const req = require.context('.', true, /\.js$/)
const load = () => {
// require('./Library')
req.keys().forEach(req)
}
configure(load, module)