Merge branch 'master' into angular-example-remove-entries

This commit is contained in:
Igor 2018-01-20 13:49:00 +02:00 committed by GitHub
commit cdc9c9f13b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Storyshots Inheritance base button 1`] = `
<storybook-dynamic-app-root
cfr={[Function CodegenComponentFactoryResolver]}
data={[Function Object]}
target={[Function ViewContainerRef_]}
>
<storybook-base-button>
<button>
this is label
</button>
</storybook-base-button>
</storybook-dynamic-app-root>
`;
exports[`Storyshots Inheritance icon button 1`] = `
<storybook-dynamic-app-root
cfr={[Function CodegenComponentFactoryResolver]}
data={[Function Object]}
target={[Function ViewContainerRef_]}
>
<storybook-icon-button>
<button>
this is label - this is icon
</button>
</storybook-icon-button>
</storybook-dynamic-app-root>
`;

View File

@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
@Component({
selector: `storybook-base-button`,
template: `
<button>{{label}}</button>
`,
})
export class BaseButtonComponent {
@Input() label: string;
}

View File

@ -0,0 +1,12 @@
import { Component, Input } from '@angular/core';
import { BaseButtonComponent } from './base-button.component';
@Component({
selector: `storybook-icon-button`,
template: `
<button>{{label}} - {{icon}}</button>
`,
})
export class IconButtonComponent extends BaseButtonComponent {
@Input() icon: string;
}

View File

@ -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',
},
}));