Skip to content

Commit

Permalink
fix: mdx components of prop
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jun 26, 2020
1 parent b227844 commit d2d968f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/instrument/src/babel/mdx-stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ export const extractMDXStories = (props: any) => (
break;
}
default:
const attributes = collectAttributes(node);
collectComponent(attributes);
break;
}
// console.log(node.name.name, attributes);
Expand Down
6 changes: 5 additions & 1 deletion core/instrument/src/misc/component-attributes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Story, Document, StoryParameters } from '@component-controls/core';

export const componentsFromParams = (
element: Document | Story | StoryParameters,
element: (Document | Story | StoryParameters) & { of?: string },
): string[] => {
const result = [];
let { component } = element;
Expand All @@ -11,6 +11,10 @@ export const componentsFromParams = (
if (typeof component === 'string') {
result.push(component);
}
const { of: componentShorthand } = element;
if (typeof componentShorthand === 'string') {
result.push(componentShorthand);
}
let { subcomponents } = element;
if (!subcomponents && element.parameters) {
({ subcomponents } = element.parameters);
Expand Down

0 comments on commit d2d968f

Please sign in to comment.