From 79609ae984595241c4fef8b60a4fa76f5ee880eb Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 3 Mar 2019 12:55:47 +0800 Subject: [PATCH] ADD new story-level decorators to angular stories --- .../src/stories/custom-pipes.stories.ts | 19 ++++++++----- .../src/stories/custom-providers.stories.ts | 25 ++++++++++------- .../src/stories/custom-styles.stories.ts | 27 +++++++++++-------- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/examples/angular-cli/src/stories/custom-pipes.stories.ts b/examples/angular-cli/src/stories/custom-pipes.stories.ts index b342d530c21c..9bb29bc75ba7 100644 --- a/examples/angular-cli/src/stories/custom-pipes.stories.ts +++ b/examples/angular-cli/src/stories/custom-pipes.stories.ts @@ -19,10 +19,15 @@ storiesOf('Custom|Pipes', module) field: 'foobar', }, })) - .addDecorator(withKnobs) - .add('With Knobs', () => ({ - component: NameComponent, - props: { - field: text('field', 'foobar'), - }, - })); + .add( + 'With Knobs', + () => ({ + component: NameComponent, + props: { + field: text('field', 'foobar'), + }, + }), + { + decorators: [withKnobs], + } + ); diff --git a/examples/angular-cli/src/stories/custom-providers.stories.ts b/examples/angular-cli/src/stories/custom-providers.stories.ts index d7ca9ed069be..12814781bcd0 100644 --- a/examples/angular-cli/src/stories/custom-providers.stories.ts +++ b/examples/angular-cli/src/stories/custom-providers.stories.ts @@ -19,14 +19,19 @@ storiesOf('Custom|Providers', module) name: 'Static name', }, })) - .addDecorator(withKnobs) - .add('With knobs', () => { - const name = text('name', 'Dynamic knob'); + .add( + 'With knobs', + () => { + const name = text('name', 'Dynamic knob'); - return { - component: ServiceComponent, - props: { - name, - }, - }; - }); + return { + component: ServiceComponent, + props: { + name, + }, + }; + }, + { + decorators: [withKnobs], + } + ); diff --git a/examples/angular-cli/src/stories/custom-styles.stories.ts b/examples/angular-cli/src/stories/custom-styles.stories.ts index df2e1b20a78c..fc14f680dde0 100644 --- a/examples/angular-cli/src/stories/custom-styles.stories.ts +++ b/examples/angular-cli/src/stories/custom-styles.stories.ts @@ -24,19 +24,24 @@ storiesOf('Custom|Style', module) `, ], })) - .addDecorator(withKnobs) - .add('With Knobs', () => ({ - template: ``, - props: { - text: text('text', 'Button with custom styles'), - onClick: action('log'), - }, - styles: [ - ` + .add( + 'With Knobs', + () => ({ + template: ``, + props: { + text: text('text', 'Button with custom styles'), + onClick: action('log'), + }, + styles: [ + ` storybook-button-component { background-color: red; padding: 25px; } `, - ], - })); + ], + }), + { + decorators: [withKnobs], + } + );