diff --git a/addons/info/src/components/Story.js b/addons/info/src/components/Story.js index ed2d789dc2ba..bda0263d4bd5 100644 --- a/addons/info/src/components/Story.js +++ b/addons/info/src/components/Story.js @@ -14,6 +14,8 @@ import { Pre } from './markdown'; global.STORYBOOK_REACT_CLASSES = global.STORYBOOK_REACT_CLASSES || []; const { STORYBOOK_REACT_CLASSES } = global; +const getName = type => type.displayName || type.name; + const stylesheet = { button: { base: { @@ -324,14 +326,13 @@ export default class Story extends React.Component { extract(this.props.children); const array = Array.from(types.keys()); - array.sort((a, b) => (a.displayName || a.name) > (b.displayName || b.name)); + array.sort((a, b) => getName(a) > getName(b)); const { maxPropObjectKeys, maxPropArrayLength, maxPropStringLength } = this.props; - const propTables = array.map(type => ( -
-

- "{type.displayName || type.name}" Component -

+ const propTables = array.map((type, i) => ( + // eslint-disable-next-line react/no-array-index-key +
+

"{getName(type)}" Component

`; +exports[`Storyshots Addon Info.GitHub issues #1814 1`] = ` +
+
+
+ + ); + +storiesOf('Addon Info.GitHub issues', module).add( + '#1814', + withInfo('Allow Duplicate DisplayNames for HOC #1814')(() => ( +
+ +