mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 16:11:33 +08:00
Run prettier:ts
This commit is contained in:
parent
f34bf30c66
commit
9ea767c2db
@ -3,7 +3,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'storybook-button-component',
|
selector: 'storybook-button-component',
|
||||||
template: `
|
template: `
|
||||||
<button (click)="onClick.emit($event);">{{ text }}</button>
|
<button (click)="onClick.emit($event)">{{ text }}</button>
|
||||||
`,
|
`,
|
||||||
styles: [
|
styles: [
|
||||||
`
|
`
|
||||||
|
@ -7,40 +7,39 @@ import { Component, Output, EventEmitter } from '@angular/core';
|
|||||||
<h1>Welcome to storybook</h1>
|
<h1>Welcome to storybook</h1>
|
||||||
<p>This is a UI component dev environment for your app.</p>
|
<p>This is a UI component dev environment for your app.</p>
|
||||||
<p>
|
<p>
|
||||||
We've added some basic stories inside the <span class="inline-code">src/stories</span> directory.
|
We've added some basic stories inside the
|
||||||
<br/>
|
<span class="inline-code">src/stories</span> directory. <br />
|
||||||
A story is a single state of one or more UI components. You can have as many stories as
|
A story is a single state of one or more UI components. You can have as many stories as you
|
||||||
you want.
|
want. <br />
|
||||||
<br/>
|
|
||||||
(Basically a story is like a visual test case.)
|
(Basically a story is like a visual test case.)
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
See these sample <a (click)="showApp.emit($event);" role="button" tabIndex="0">stories</a> for a component called
|
See these sample
|
||||||
<span class="inline-code">Button</span> .
|
<a (click)="showApp.emit($event)" role="button" tabIndex="0">stories</a> for a component
|
||||||
|
called <span class="inline-code">Button</span> .
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Just like that, you can add your own components as stories.
|
Just like that, you can add your own components as stories. <br />
|
||||||
<br />
|
You can also edit those components and see changes right away. <br />
|
||||||
You can also edit those components and see changes right away.
|
(Try editing the <span class="inline-code">Button</span> stories located at
|
||||||
<br />
|
<span class="inline-code">src/stories/index.js</span>.)
|
||||||
(Try editing the <span class="inline-code">Button</span> stories
|
|
||||||
located at <span class="inline-code">src/stories/index.js</span>.)
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Usually we create stories with smaller UI components in the app.<br />
|
Usually we create stories with smaller UI components in the app.<br />
|
||||||
Have a look at the <a
|
Have a look at the
|
||||||
|
<a
|
||||||
href="https://storybook.js.org/basics/writing-stories"
|
href="https://storybook.js.org/basics/writing-stories"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
Writing Stories
|
Writing Stories
|
||||||
</a> section in our documentation.
|
</a>
|
||||||
|
section in our documentation.
|
||||||
</p>
|
</p>
|
||||||
<p class="note">
|
<p class="note">
|
||||||
<b>NOTE:</b>
|
<b>NOTE:</b> <br />
|
||||||
<br />
|
Have a look at the <span class="inline-code">.storybook/webpack.config.js</span> to add
|
||||||
Have a look at the <span class="inline-code">.storybook/webpack.config.js</span>
|
webpack loaders and plugins you are using in this project.
|
||||||
to add webpack loaders and plugins you are using in this project.
|
|
||||||
</p>
|
</p>
|
||||||
</main>
|
</main>
|
||||||
`,
|
`,
|
||||||
|
@ -3,16 +3,17 @@ import { Component, Input, OnInit, OnChanges, SimpleChanges } from '@angular/cor
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'storybook-simple-knobs-component',
|
selector: 'storybook-simple-knobs-component',
|
||||||
template: `
|
template: `
|
||||||
<div [ngStyle]="{ 'border': '2px dotted ' + border, 'padding.px': '8 22', 'border-radius.px': '8'}">
|
<div
|
||||||
|
[ngStyle]="{ border: '2px dotted ' + border, 'padding.px': '8 22', 'border-radius.px': '8' }"
|
||||||
|
>
|
||||||
<h1>My name is {{ name }},</h1>
|
<h1>My name is {{ name }},</h1>
|
||||||
<h3>today is {{ today | date }}</h3>
|
<h3>today is {{ today | date }}</h3>
|
||||||
<p *ngIf="stock">I have a stock of {{ stock }} {{ fruit }}, costing $ {{ price }} each.</p>
|
<p *ngIf="stock">I have a stock of {{ stock }} {{ fruit }}, costing $ {{ price }} each.</p>
|
||||||
<p *ngIf="!stock">I'm out of {{ fruit }}.</p> <p *ngIf="stock && nice">Sorry.</p>
|
<p *ngIf="!stock">I'm out of {{ fruit }}.</p>
|
||||||
|
<p *ngIf="stock && nice">Sorry.</p>
|
||||||
<p>Also, I have:</p>
|
<p>Also, I have:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let item of items">
|
<li *ngFor="let item of items">{{ item }}</li>
|
||||||
{{ item }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<p *ngIf="nice">Nice to meet you!</p>
|
<p *ngIf="nice">Nice to meet you!</p>
|
||||||
<p *ngIf="!nice">Leave me alone!</p>
|
<p *ngIf="!nice">Leave me alone!</p>
|
||||||
|
@ -3,7 +3,9 @@ import { storiesOf } from '@storybook/angular';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'storybook-with-ng-content',
|
selector: 'storybook-with-ng-content',
|
||||||
template: `<div style="color: #1e88e5;"><ng-content></ng-content></div>`,
|
template: `
|
||||||
|
<div style="color: #1e88e5;"><ng-content></ng-content></div>
|
||||||
|
`,
|
||||||
})
|
})
|
||||||
class WithNgContentComponent {}
|
class WithNgContentComponent {}
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@ import { Component, Input } from '@angular/core';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'storybook-name',
|
selector: 'storybook-name',
|
||||||
template: `<h1>{{ field | customPipe }}</h1>`,
|
template: `
|
||||||
|
<h1>{{ field | customPipe }}</h1>
|
||||||
|
`,
|
||||||
})
|
})
|
||||||
export class NameComponent {
|
export class NameComponent {
|
||||||
@Input()
|
@Input()
|
||||||
|
@ -6,9 +6,7 @@ import { DummyService } from './dummy.service';
|
|||||||
template: `
|
template: `
|
||||||
<p>{{ name }}:</p>
|
<p>{{ name }}:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let item of items">
|
<li *ngFor="let item of items">{{ item }}</li>
|
||||||
{{ item }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
|
@ -9,9 +9,7 @@ export const DEFAULT_NAME = new InjectionToken<string>('TokenComponent.DefaultNa
|
|||||||
<h3>{{ name }}</h3>
|
<h3>{{ name }}</h3>
|
||||||
<p>Items:</p>
|
<p>Items:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let item of items">
|
<li *ngFor="let item of items">{{ item }}</li>
|
||||||
{{ item }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user