Skip to content

Commit

Permalink
Merge pull request #929 from konsumer/master
Browse files Browse the repository at this point in the history
add description field from __docgenInfo for prop table for info plugin
  • Loading branch information
ndelangen authored Apr 28, 2017
2 parents b0313a1 + 67e325d commit 25d8a2e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/addon-info/src/components/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
}

Expand Down Expand Up @@ -72,6 +73,7 @@ export default class PropTable extends React.Component {
<th>propType</th>
<th>required</th>
<th>default</th>
<th>description></th>
</tr>
</thead>
<tbody>
Expand All @@ -81,6 +83,7 @@ export default class PropTable extends React.Component {
<td>{row.propType}</td>
<td>{row.required}</td>
<td>{row.defaultValue === undefined ? '-' : <PropVal val={row.defaultValue} />}</td>
<td>{row.description}</td>
</tr>
))}
</tbody>
Expand Down

0 comments on commit 25d8a2e

Please sign in to comment.