Skip to content

Commit

Permalink
fixup! feat(angular): depreciate the story component attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaudAV committed Dec 10, 2020
1 parent 33cd052 commit 2103688
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions app/angular/src/client/preview/angular-beta/RenderNgAppService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ import { createComponentClassFromStoryTemplate } from './ComponentClassFromStory
import { isComponentAlreadyDeclaredInModules } from './NgModulesAnalyzer';
import { isDeclarable } from './NgComponentAnalyzer';

const deprecatedStoryComponentWarning = deprecate(
() => {},
dedent`\`component\` story input is deprecated, and will be removed in Storybook 7.0.
Instead, use \`export const default = () => ({ component: AppComponent });\`
or
\`\`\`
export const Primary: Story = () => ({});
Primary.parameters = { component: AppComponent };
\`\`\`
Read more at
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-angular-story-component).
- https://storybook.js.org/docs/angular/writing-stories/parameters
`
);

/**
* Bootstrap angular application and allows to change the rendering dynamically
* To be used as a singleton so has to set global properties of render function
Expand Down Expand Up @@ -49,20 +64,7 @@ export class RenderNgAppService {
} = storyFnAngular;

if (storyComponent) {
deprecate(
() => {},
dedent`\`component\` story input is deprecated, and will be removed in Storybook 7.0.
Instead, use \`export const default = () => ({ component: AppComponent });\`
or
\`\`\`
export const Primary: Story = () => ({});
Primary.parameters = { component: AppComponent };
\`\`\`
Read more at
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-angular-story-component).
- https://storybook.js.org/docs/angular/writing-stories/parameters
`
)();
deprecatedStoryComponentWarning();
}
const component = storyComponent ?? parameters.component;

Expand Down

0 comments on commit 2103688

Please sign in to comment.