mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
38 lines
800 B
TypeScript
38 lines
800 B
TypeScript
import { storiesOf, moduleMetadata } from '@storybook/angular';
|
|
import { withKnobs, text } from '@storybook/addon-knobs';
|
|
|
|
import { DummyService } from './moduleMetadata/dummy.service';
|
|
import { ServiceComponent } from './moduleMetadata/service.component';
|
|
|
|
storiesOf('Custom|Providers', module)
|
|
.addDecorator(
|
|
moduleMetadata({
|
|
imports: [],
|
|
schemas: [],
|
|
declarations: [],
|
|
providers: [DummyService],
|
|
})
|
|
)
|
|
.add('Simple', () => ({
|
|
component: ServiceComponent,
|
|
props: {
|
|
name: 'Static name',
|
|
},
|
|
}))
|
|
.add(
|
|
'With knobs',
|
|
() => {
|
|
const name = text('name', 'Dynamic knob');
|
|
|
|
return {
|
|
component: ServiceComponent,
|
|
props: {
|
|
name,
|
|
},
|
|
};
|
|
},
|
|
{
|
|
decorators: [withKnobs],
|
|
}
|
|
);
|