Skip to content

Commit

Permalink
fix(storybook): component props should only consider inputs #9417 (#9780
Browse files Browse the repository at this point in the history
)

Previously, all decorators were being taken into consideration. However, props to an Angular component would be its Inputs.
We should only consider those.

Fixes #9417
  • Loading branch information
Coly010 authored and FrozenPandaz committed Apr 13, 2022
1 parent 168c659 commit d2bf124
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/angular/src/generators/utils/storybook.ts
Expand Up @@ -41,11 +41,15 @@ export function getComponentProps(
const props = getInputPropertyDeclarations(tree, componentPath).map(
(node) => {
const decoratorContent = findNodes(
findNodes(node, SyntaxKind.Decorator)[0],
findNodes(node, SyntaxKind.Decorator).find((n) =>
n.getText().startsWith('@Input')
),
SyntaxKind.StringLiteral
);
const name = decoratorContent.length
? decoratorContent[0].getText().slice(1, -1)
? !decoratorContent[0].getText().includes('.')
? decoratorContent[0].getText().slice(1, -1)
: node.name.getText()
: node.name.getText();

const type = getKnobType(node);
Expand Down

0 comments on commit d2bf124

Please sign in to comment.