1
1
mirror of https://github.com/primer/css.git synced 2024-12-15 07:23:54 +03:00
css/.storybook/config.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-09-13 09:55:58 +03:00
import React from 'react'
2019-03-06 09:07:53 +03:00
import {configure, addParameters, addDecorator} from '@storybook/react'
2019-03-06 08:43:02 +03:00
import {name, homepage, version} from '../package.json'
import {INITIAL_VIEWPORTS} from '@storybook/addon-viewport'
2017-08-15 00:44:26 +03:00
// this enables HMR for the SCSS source files
2019-03-06 08:43:02 +03:00
import '../src/index.scss'
// wrap every view in 4x padding
addDecorator(story => <div className="p-4">{story()}</div>)
2019-03-06 08:43:02 +03:00
addParameters({
options: {
brandTitle: `${name}@${version}`,
brandUrl: homepage,
showAddonsPanel: false
},
viewport: {
viewports: {
2019-03-06 08:43:02 +03:00
sm: {
name: 'Small ($width-sm)',
styles: {width: '544px', height: 'auto'}
2019-03-06 08:43:02 +03:00
},
md: {
name: 'Medium ($width-md)',
styles: {width: '768px', height: 'auto'}
2019-03-06 08:43:02 +03:00
},
lg: {
name: 'Large ($width-lg)',
styles: {width: '1012px', height: 'auto'}
2019-03-06 08:43:02 +03:00
},
xl: {
name: 'XL ($width-xl)',
styles: {width: '1280px', height: 'auto'}
},
...INITIAL_VIEWPORTS
}
2019-03-06 08:43:02 +03:00
}
})
2017-09-13 09:55:58 +03:00
configure(() => {
2019-03-08 01:41:36 +03:00
const loadMarkdown = require.context('../pages/css', true, /\.md$/)
2019-03-06 08:43:02 +03:00
for (const path of loadMarkdown.keys()) {
loadMarkdown(path)
}
}, module)