Skip to content

Commit

Permalink
feat: add description block
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 3, 2020
1 parent 3949702 commit 7fabe82
Show file tree
Hide file tree
Showing 33 changed files with 1,298 additions and 1,522 deletions.
13 changes: 2 additions & 11 deletions core/core/src/smartControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,10 @@ import {
ComponentControl,
ComponentControls,
ControlTypes,
PropType,
PropTypes,
} from '@component-controls/specification';

export interface PropType {
defaultValue: { value?: string | boolean; computed: boolean };
type: { name?: string };
required: boolean;
description: string;
}

export interface PropTypes {
[key: string]: PropType;
}

const cleanQuotes = (txt?: string) => (txt ? txt.replace(/['"]+/g, '') : txt);

const handledTypes = [
Expand Down
18 changes: 16 additions & 2 deletions core/instrument/src/babel/control-values-in-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,22 @@ export const addArgumentUsage = (
};
export const extractArgumentsUsage = (story: Story, args: StoryArguments) => {
return {
Identifier: (path: any) => {
addArgumentUsage(story, args, path.node);
TemplateLiteral: (path: any) => {
path.node.expressions.forEach((expression: any) => {
if (expression.type === 'Identifier') {
addArgumentUsage(story, args, expression);
}
});
},
JSXSpreadAttribute: (path: any) => {
if (path.node.argument === 'Identifier') {
addArgumentUsage(story, args, path.node.argument);
}
},
ArrowFunctionExpression: (path: any) => {
if (path.node.body === 'Identifier') {
addArgumentUsage(story, args, path.node.body);
}
},
Property: (path: any) => {
const node = path.node;
Expand Down
Loading

0 comments on commit 7fabe82

Please sign in to comment.