Skip to content

Commit

Permalink
Display more info on default props
Browse files Browse the repository at this point in the history
Default props on the prop table are displayed using the same 'PropVal' component used in source code section.
  • Loading branch information
roonyh committed Jun 23, 2016
1 parent fd40cf3 commit 3704527
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/PropTable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropVal from './PropVal'

const PropTypesMap = new Map();
for (let typeName in React.PropTypes) {
Expand Down Expand Up @@ -27,8 +28,7 @@ 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';
const defaultValue = '-';
props[property] = {property, propType, required, defaultValue};
props[property] = {property, propType, required};
}
}

Expand Down Expand Up @@ -72,7 +72,7 @@ export default class PropTable extends React.Component {
<td>{row.property}</td>
<td>{row.propType}</td>
<td>{row.required}</td>
<td>{row.defaultValue.toString()}</td>
<td>{row.defaultValue === undefined ? '-' : <PropVal val={row.defaultValue} />}</td>
</tr>
))}
</tbody>
Expand Down

0 comments on commit 3704527

Please sign in to comment.