From 67e325d030073c719f1a0edd69f879c92f91bf08 Mon Sep 17 00:00:00 2001 From: David Konsumer Date: Fri, 21 Apr 2017 16:00:48 -0700 Subject: [PATCH] add description field from __docgenInfo for prop table --- packages/addon-info/src/components/PropTable.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/addon-info/src/components/PropTable.js b/packages/addon-info/src/components/PropTable.js index 7b200a2c751..fb1034e9c11 100644 --- a/packages/addon-info/src/components/PropTable.js +++ b/packages/addon-info/src/components/PropTable.js @@ -38,7 +38,8 @@ export default class PropTable extends React.Component { const typeInfo = type.propTypes[property]; const propType = PropTypesMap.get(typeInfo) || 'other'; const required = typeInfo.isRequired === undefined ? 'yes' : 'no'; - props[property] = { property, propType, required }; + const description = type.__docgenInfo && type.__docgenInfo.props && type.__docgenInfo.props[property] ? type.__docgenInfo.props[property].description : null; + props[property] = { property, propType, required, description }; } } @@ -72,6 +73,7 @@ export default class PropTable extends React.Component { propType required default + description> @@ -81,6 +83,7 @@ export default class PropTable extends React.Component { {row.propType} {row.required} {row.defaultValue === undefined ? '-' : } + {row.description} ))}