Skip to content

Commit

Permalink
feat(storybook): add @storybook/addon-docs. update stories
Browse files Browse the repository at this point in the history
  • Loading branch information
reme3d2y committed Mar 26, 2020
1 parent 9d7c2f2 commit 1e66461
Show file tree
Hide file tree
Showing 7 changed files with 1,489 additions and 52 deletions.
1 change: 1 addition & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
addons: [
'@storybook/addon-actions',
'@storybook/addon-knobs',
'@storybook/addon-docs',
'@storybook/preset-create-react-app',
],
};
15 changes: 14 additions & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@ module.exports = ({ config }) => ({
],
},
},
require.resolve('react-docgen-typescript-loader'),
{
loader: require.resolve("react-docgen-typescript-loader"),
options: {
tsconfigPath: path.resolve(__dirname, "../tsconfig.storybook.json"),
propFilter: (props, component) => {
if (props.parent) {
// Показываем только пользовательские пропсы. (Иначе будет простыня из HTMLAttributes)
return !props.parent.fileName.includes('node_modules');
} else {
return true;
}
}
}
}
],
include: [path.resolve('./')],
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@storybook/addon-actions": "^5.3.8",
"@storybook/addon-docs": "^5.3.17",
"@storybook/addon-knobs": "^5.3.8",
"@storybook/addons": "^5.3.8",
"@storybook/preset-typescript": "^1.2.0",
Expand All @@ -53,10 +54,10 @@
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^8.0.4",
"@types/classnames": "^2.2.9",
"@types/jest": "^25.1.2",
"@types/node": "^13.5.0",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@types/jest": "^25.1.2",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"alfa-ui-primitives": "2.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/button/src/Component.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const icon = (
);

export default {
title: 'Common',
title: 'Common|Button',
component: Button,
decorators: [withKnobs],
};
Expand Down
2 changes: 1 addition & 1 deletion src/input/src/Component.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { withDesign } from 'storybook-addon-designs';
import { Input } from './Component';

export default {
title: 'Common',
title: 'Common|Input',
component: Input,
decorators: [withDesign, withKnobs],
};
Expand Down
2 changes: 1 addition & 1 deletion src/pure-input/src/Component.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { withDesign } from 'storybook-addon-designs';
import { PureInput } from './Component';

export default {
title: 'Common',
title: 'Common|PureInput',
component: PureInput,
decorators: [withDesign, withKnobs],
};
Expand Down

0 comments on commit 1e66461

Please sign in to comment.