Skip to content

Commit

Permalink
Merge branch 'master' into dependency-updates
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/addon-notes/package.json
  • Loading branch information
ndelangen committed May 10, 2017
2 parents d26c086 + 902ad20 commit 06d5437
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/addon-info/src/components/Story.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default class Story extends React.Component {
}

// depth-first traverse and collect types
function extract(children) {
const extract = children => {
if (!children) {
return;
}
Expand All @@ -260,13 +260,15 @@ export default class Story extends React.Component {
if (children.props && children.props.children) {
extract(children.props.children);
}
if (typeof children === 'string' || typeof children.type === 'string') {
if (typeof children === 'string' || typeof children.type === 'string' ||
(Array.isArray(this.props.propTablesExclude) && // also ignore excluded types
~this.props.propTablesExclude.indexOf(children.type))) {
return;
}
if (children.type && !types.has(children.type)) {
types.set(children.type, true);
}
}
};

// extract components from children
extract(this.props.children);
Expand Down Expand Up @@ -311,6 +313,7 @@ Story.propTypes = {
context: PropTypes.object,
info: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
propTables: PropTypes.arrayOf(PropTypes.func),
propTablesExclude: PropTypes.arrayOf(PropTypes.func),
showInline: PropTypes.bool,
showHeader: PropTypes.bool,
showSource: PropTypes.bool,
Expand Down
1 change: 1 addition & 0 deletions packages/addon-info/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default {
showHeader: Boolean(options.header),
showSource: Boolean(options.source),
propTables: options.propTables,
propTablesExclude: options.propTablesExclude,
styles: typeof options.styles === 'function' ? options.styles : s => s,
mtrcConf,
};
Expand Down
5 changes: 4 additions & 1 deletion packages/addon-notes/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"name": "@kadira/storybook-addon-notes",
"version": "1.0.1",
"description": "Write notes for your Storybook stories.",
Expand Down Expand Up @@ -26,6 +26,9 @@
"dependencies": {
"babel-runtime": "^6.23.0"
},
"optionalDependencies": {
"@types/react": "^15.0.24"
},
"main": "dist/index.js",
"keywords": [
"react",
Expand Down
7 changes: 7 additions & 0 deletions packages/addon-notes/storybook-addon-notes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from 'react';

export interface WithNotesProps extends React.HTMLProps<HTMLDivElement> {
notes?: string;
}

export const WithNotes: React.StatelessComponent<WithNotesProps>;

0 comments on commit 06d5437

Please sign in to comment.