Skip to content

Commit

Permalink
feat(examples): added dummy pipe and injectable to show their props
Browse files Browse the repository at this point in the history
  • Loading branch information
matheo committed Jun 3, 2020
1 parent b10834c commit 0233802
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots DocInjectable Basic 1`] = `
<storybook-dynamic-app-root
cfr={[Function CodegenComponentFactoryResolver]}
data={[Function Object]}
target={[Function ViewContainerRef_]}
>
<ng-component>
<div>
<h1>
DocInjectable
</h1>
</div>
</ng-component>
</storybook-dynamic-app-root>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Injectable } from '@angular/core';
import { HttpHeaders } from '@angular/common/http';

/**
* This is an Angular Injectable
* example that has a Prop Table.
*/
@Injectable({
providedIn: 'root',
})
export class DocInjectableService {
/**
* Auth headers to use.
*/
auth: any;

constructor() {
this.auth = new HttpHeaders({ 'Content-Type': 'application/json' });
}

/**
* Get posts from Backend.
*/
getPosts() {
return [];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { DocInjectableService } from './doc-injectable.service';

export default {
title: 'DocInjectable',
component: DocInjectableService,
parameters: { docs: { iframeHeight: 120 } },
};

const modules = {
provider: [DocInjectableService],
};

export const Basic = () => ({
moduleMetadata: modules,
template: '<div><h1>DocInjectable</h1></div>',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots DocPipe Basic 1`] = `
<storybook-dynamic-app-root
cfr={[Function CodegenComponentFactoryResolver]}
data={[Function Object]}
target={[Function ViewContainerRef_]}
>
<ng-component>
<div>
<h1>
DOCPIPE
</h1>
</div>
</ng-component>
</storybook-dynamic-app-root>
`;
18 changes: 18 additions & 0 deletions examples/angular-cli/src/stories/doc-pipe/doc-pipe.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Pipe, PipeTransform } from '@angular/core';

/**
* This is an Angular Pipe
* example that has a Prop Table.
*/
@Pipe({
name: 'docPipe',
})
export class DocPipe implements PipeTransform {
/**
* Transforms a string into uppercase.
* @param value string
*/
transform(value: string): string {
return value?.toUpperCase();
}
}
16 changes: 16 additions & 0 deletions examples/angular-cli/src/stories/doc-pipe/doc-pipe.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { DocPipe } from './doc-pipe.pipe';

export default {
title: 'DocPipe',
component: DocPipe,
parameters: { docs: { iframeHeight: 120 } },
};

const modules = {
declarations: [DocPipe],
};

export const Basic = () => ({
moduleMetadata: modules,
template: `<div><h1>{{ 'DocPipe' | docPipe }}</h1></div>`,
});

0 comments on commit 0233802

Please sign in to comment.