Skip to content

Commit

Permalink
chore(storybook): add an example for DocPage component to storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
yndx-birman committed May 22, 2020
1 parent 050f137 commit 9ac01aa
Show file tree
Hide file tree
Showing 23 changed files with 548 additions and 183 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules

/build
/storybook-static
/dist
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://npm.yandex-team.ru/
16 changes: 14 additions & 2 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
import '../src/demo/reset-storybook.scss';
import '../styles/default.scss';
import '../styles/typography.scss';
import '../styles/themes.scss';

import React from 'react';
import {configure, addDecorator, addParameters} from '@storybook/react';
import {withKnobs} from '@storybook/addon-knobs';
import {addReadme} from 'storybook-readme';

import withTheme from '../src/demo/decorators/withTheme';

addParameters({
options: {
panelPosition: 'right',
theme: {
brandTitle: 'Docs Components',
brandUrl: 'https://github.yandex-team.ru/data-ui/docs-components',
},
showPanel: true,
}
});
addDecorator(addReadme);
addDecorator(withKnobs);
addDecorator(withTheme);

addDecorator((Story, context) => (
<main>
<Pointerfocus/>
<Story {...context}/>
</main>
));

configure(require.context('../src/stories', true, /\.stories.tsx?$/), module);
function loadStories() {
require('../src/stories/Components.stories');
}

configure(loadStories, module);
15 changes: 14 additions & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ config
options: {
extract: true,
spriteFilename: 'sprite-[hash:6].svg'
}
},
exclude: [path.resolve(assetsRoot, 'icons')],
})
.module.addRule({
test: /\.css$/,
use: [
'style-loader',
{loader: 'css-loader'}
],
})
.module.addRule({
test: /\.svg$/,
loader: 'react-svg-loader',
include: [path.resolve(assetsRoot, 'icons')],
})
.plugins.addPlugin(new SpriteLoaderPlugin({plainSprite: true}));

Expand Down
4 changes: 4 additions & 0 deletions dist/configs/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
authPolicy: 'disabled',
socket: 'dist/run/server.sock',
};
3 changes: 3 additions & 0 deletions dist/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (req, res) => {
res.redirect('/index.html');
};
6 changes: 6 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Core = require('@yandex-data-ui/core');

const app = new Core({name: 'docs-components'});
module.exports = app;

app.run();
3 changes: 3 additions & 0 deletions dist/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'GET /': 'index',
};
Loading

0 comments on commit 9ac01aa

Please sign in to comment.