diff --git a/addons/info/src/components/PropTable.js b/addons/info/src/components/PropTable.js index 5fdec2d4ddf0..96000bb1182a 100644 --- a/addons/info/src/components/PropTable.js +++ b/addons/info/src/components/PropTable.js @@ -36,13 +36,23 @@ export default class PropTable extends React.Component { continue; } const typeInfo = type.propTypes[property]; - const propType = PropTypesMap.get(typeInfo) || 'other'; + let propType = PropTypesMap.get(typeInfo) || 'other'; const required = typeInfo.isRequired === undefined ? 'yes' : 'no'; const description = type.__docgenInfo && type.__docgenInfo.props && type.__docgenInfo.props[property] ? type.__docgenInfo.props[property].description : null; + if (propType === 'other') { + if ( + type.__docgenInfo && + type.__docgenInfo.props && + type.__docgenInfo.props[property] && + type.__docgenInfo.props[property].type + ) { + propType = type.__docgenInfo.props[property].type.name; + } + } props[property] = { property, propType, required, description }; } } diff --git a/addons/info/src/components/Story.js b/addons/info/src/components/Story.js index e8ef89f5c398..a3736a479cb3 100644 --- a/addons/info/src/components/Story.js +++ b/addons/info/src/components/Story.js @@ -121,6 +121,7 @@ export default class Story extends React.Component {
{this._getInfoContent()} + {this._getComponentDescription()} {this._getSourceCode()} {this._getPropTables()}
@@ -162,6 +163,7 @@ export default class Story extends React.Component {
{this._getInfoHeader()} {this._getInfoContent()} + {this._getComponentDescription()} {this._getSourceCode()} {this._getPropTables()}
@@ -214,6 +216,24 @@ export default class Story extends React.Component { ); } + _getComponentDescription() { + let retDiv = null; + + if (Object.keys(STORYBOOK_REACT_CLASSES).length) { + Object.keys(STORYBOOK_REACT_CLASSES).forEach((key, index) => { + if (STORYBOOK_REACT_CLASSES[key].name === this.props.context.kind) { + retDiv = ( +
+ {STORYBOOK_REACT_CLASSES[key].docgenInfo.description} +
+ ); + } + }); + } + + return retDiv; + } + _getSourceCode() { if (!this.props.showSource) { return null; @@ -298,8 +318,6 @@ export default class Story extends React.Component { {propTables}
); - - return; } render() {