From a9c93105e36dac8a84c808d0e1fcd64884caf61d Mon Sep 17 00:00:00 2001 From: igor Date: Fri, 19 Jan 2018 19:30:51 +0200 Subject: [PATCH 1/2] Add inheritance example --- .../inheritance.stories.storyshot | 1 + .../inheritance/base-button.component.ts | 11 +++++++++++ .../inheritance/icon-button.component.ts | 12 ++++++++++++ .../stories/inheritance/inheritance.stories.ts | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot create mode 100644 examples/angular-cli/src/stories/inheritance/base-button.component.ts create mode 100644 examples/angular-cli/src/stories/inheritance/icon-button.component.ts create mode 100644 examples/angular-cli/src/stories/inheritance/inheritance.stories.ts diff --git a/examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot b/examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot new file mode 100644 index 000000000000..41a24f5258e0 --- /dev/null +++ b/examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot @@ -0,0 +1 @@ + this is label diff --git a/examples/angular-cli/src/stories/inheritance/base-button.component.ts b/examples/angular-cli/src/stories/inheritance/base-button.component.ts new file mode 100644 index 000000000000..c50445dbd29f --- /dev/null +++ b/examples/angular-cli/src/stories/inheritance/base-button.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: `storybook-base-button`, + template: ` + + `, +}) +export class BaseButtonComponent { + @Input() label: string; +} diff --git a/examples/angular-cli/src/stories/inheritance/icon-button.component.ts b/examples/angular-cli/src/stories/inheritance/icon-button.component.ts new file mode 100644 index 000000000000..7207072e5cc7 --- /dev/null +++ b/examples/angular-cli/src/stories/inheritance/icon-button.component.ts @@ -0,0 +1,12 @@ +import { Component, Input } from '@angular/core'; +import { BaseButtonComponent } from './base-button.component'; + +@Component({ + selector: `storybook-icon-button`, + template: ` + + `, +}) +export class IconButtonComponent extends BaseButtonComponent { + @Input() icon: string; +} diff --git a/examples/angular-cli/src/stories/inheritance/inheritance.stories.ts b/examples/angular-cli/src/stories/inheritance/inheritance.stories.ts new file mode 100644 index 000000000000..23cd031a3a0e --- /dev/null +++ b/examples/angular-cli/src/stories/inheritance/inheritance.stories.ts @@ -0,0 +1,18 @@ +import { storiesOf } from '@storybook/angular'; +import { IconButtonComponent } from './icon-button.component'; +import { BaseButtonComponent } from './base-button.component'; + +storiesOf('Inheritance', module) + .add('icon button', () => ({ + component: IconButtonComponent, + props: { + icon: 'this is icon', + label: 'this is label', + }, + })) + .add('base button', () => ({ + component: BaseButtonComponent, + props: { + label: 'this is label', + }, + })); From 42966d8479079da3a1b62e9cfa37c5136d65e445 Mon Sep 17 00:00:00 2001 From: igor Date: Fri, 19 Jan 2018 19:32:18 +0200 Subject: [PATCH 2/2] Add inheritance example --- .../inheritance.stories.storyshot | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot b/examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot index 41a24f5258e0..67e21a5c1f77 100644 --- a/examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot +++ b/examples/angular-cli/src/stories/inheritance/__snapshots__/inheritance.stories.storyshot @@ -1 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Inheritance base button 1`] = ` + + + + + + + + + +`; + +exports[`Storyshots Inheritance icon button 1`] = ` + + + + + + + + + +`;