Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

feat: auto generate prop info #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { configure, addDecorator,addParameters } from '@storybook/react';
import { withA11y } from '@storybook/addon-a11y';
import { withKnobs } from '@storybook/addon-knobs';
import { withInfo } from '@storybook/addon-info';
import { createGlobalStyle } from 'styled-components';
import { ThemeProvider } from '../src';
import theme from './theme';
Expand Down Expand Up @@ -47,6 +48,12 @@ addDecorator(story => (
</ThemeProvider>
));

addDecorator(
withInfo({
source: false,
})
);

// automatically import all files ending in *.stories.js
configure(
[
Expand Down
17 changes: 12 additions & 5 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ module.exports = {
webpackFinal: async config => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve('babel-loader'),
options: {
presets: [['react-app', { flow: false, typescript: true }]],
},
use: [
{
loader: require.resolve('babel-loader'),
options: {
presets: [['react-app', { flow: false, typescript: true }]],
},
},
{
loader: require.resolve('react-docgen-typescript-loader'),
},
],
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
},
};
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@storybook/addon-a11y": "5.3.18",
"@storybook/addon-actions": "5.3.18",
"@storybook/addon-docs": "5.3.18",
"@storybook/addon-info": "^5.3.19",
"@storybook/addon-knobs": "5.3.18",
"@storybook/addon-links": "5.3.18",
"@storybook/addon-storysource": "5.3.18",
Expand All @@ -86,6 +87,7 @@
"nodemon": "^1.19.1",
"npm-run-all": "^4.1.5",
"react": "^16.8.3",
"react-docgen-typescript-loader": "^3.7.2",
"react-dom": "^16.8.3",
"react-router-dom": "^4.2.2",
"rimraf": "^2.6.3",
Expand Down
2 changes: 1 addition & 1 deletion src/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import { css } from 'styled-components';
import { createComponent } from '../utils';

interface IconProps {
export interface IconProps {
name: string;
size?: number;
color?: string;
Expand Down
Loading