Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 94d4188

Browse files
committed
filling in info and styling updates
1 parent bf4bd05 commit 94d4188

File tree

6 files changed

+148
-20
lines changed

6 files changed

+148
-20
lines changed

src/app/operators/components/operator/operator.component.html

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,60 @@ <h3 class="short-description" [innerHTML]="shortDescription"></h3>
99
<div class="marble-wrapper mat-elevation-z2">
1010
<img class="marble-diagram" [src]="marbleUrl" *ngIf="marbleUrl"/>
1111
</div>
12+
<h2> Parameters </h2>
13+
<table class="parameter-table mat-elevation-z2">
14+
<thead>
15+
<tr>
16+
<th>Name</th>
17+
<th>Type</th>
18+
<th>Attribute</th>
19+
<th>Description</th>
20+
</tr>
21+
</thead>
22+
<tbody>
23+
<tr *ngFor="let parameter of parameters">
24+
<td> {{parameter.name}} </td>
25+
<td> {{parameter.type}} </td>
26+
<td> {{parameter.attribute}} </td>
27+
<td> {{parameter.description}} </td>
28+
</tr>
29+
</tbody>
30+
</table>
1231
<h2 class="examples-header"> Examples </h2>
1332
<div
1433
class="code-example"
1534
*ngFor="let example of examples"
1635
appHighlightJs>
1736
<h3 [innerHTML]="example.name"></h3>
18-
<pre [innerHTML]="example.code" class="mat-elevation-z2"></pre>
37+
<div class="code-block mat-elevation-z2">
38+
<button mat-icon-button [matMenuTriggerFor]="menu" class="menu-button">
39+
<mat-icon>more_vert</mat-icon>
40+
</button>
41+
<mat-menu #menu="matMenu">
42+
<a
43+
mat-menu-item
44+
[href]="link.url"
45+
target="_blank"
46+
*ngFor="let link of example.externalLinks">
47+
{{link.platform}}
48+
</a>
49+
</mat-menu>
50+
<pre [innerHTML]="example.code"></pre>
51+
</div>
1952
</div>
2053
<h2 class="related-operators"> Related Operators </h2>
21-
<ul class="related-list">
54+
<ul class="section-list">
2255
<li *ngFor="let related of relatedOperators">
2356
<a [href]="'/operators#' + related"> {{ related }} </a>
2457
</li>
2558
</ul>
26-
<h2> Additional References </h2>
59+
<h2> Additional Resources </h2>
60+
<ul class="section-list">
61+
<li>
62+
<a [href]="sourceUrl" target="_blank"> Source Code </a>
63+
</li>
64+
<li *ngFor="let resource of additionalResources">
65+
<a [href]="resource.url" target="_blank"> {{ resource.name }} </a>
66+
</li>
67+
</ul>
2768
</section>

src/app/operators/components/operator/operator.component.scss

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
@import '../../../../styles/media-helpers';
22

3+
h2 {
4+
margin: 16px 0 16px;
5+
}
6+
37
.main-operator-container {
48
padding: 5px;
59
display: flex;
610
flex-direction: column;
711
padding: 0 16px;
812
}
913

10-
.related-list {
14+
.section-list {
1115
padding: 1px;
1216
list-style-type: none;
1317
margin-top: 0;
@@ -24,10 +28,6 @@
2428
margin: 16px 0 32px;
2529
}
2630

27-
.related-operators {
28-
margin-top: 16px;
29-
}
30-
3131
.examples-header {
3232
margin: 32px 0 16px;
3333
}
@@ -44,3 +44,34 @@
4444
max-width: 100%;
4545
}
4646
}
47+
48+
.parameter-table {
49+
border-collapse: collapse;
50+
border-radius: 2px;
51+
border-spacing: 0;
52+
margin: 0 0 32px 0;
53+
width: 100%;
54+
55+
th {
56+
// font-weight: 400;
57+
max-width: 100px;
58+
padding: 12px 18px;
59+
text-align: left;
60+
}
61+
62+
td {
63+
font-weight: 400;
64+
padding: 8px 16px;
65+
border: 1px solid rgba(0,0,0,.03);
66+
}
67+
}
68+
69+
.code-block {
70+
position: relative;
71+
}
72+
73+
.menu-button {
74+
position: absolute;
75+
right: 0;
76+
top: 0;
77+
}

src/app/operators/components/operator/operator.component.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ export class OperatorComponent {
2222
}
2323

2424
get shortDescription() {
25-
return this.operator.shortDescription;
25+
return this.operator.shortDescription && this.operator.shortDescription.description;
26+
}
27+
28+
get longDescription() {
29+
return this.operator.longDescription && this.operator.shortDescription.description;
30+
}
31+
32+
get parameters() {
33+
return this.operator.parameters || [];
2634
}
2735

2836
get examples() {
@@ -32,4 +40,12 @@ export class OperatorComponent {
3240
get relatedOperators() {
3341
return this.operator.relatedOperators || [];
3442
}
43+
44+
get sourceCode() {
45+
return `https://github.com/ReactiveX/rxjs/blob/master/src/operators/${this.operatorName}.ts`;
46+
}
47+
48+
get additionalResources() {
49+
return this.operator.additionalResources || [];
50+
}
3551
}

src/app/operators/operators.module.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import {
77
MatToolbarModule,
88
MatExpansionModule,
99
MatCardModule,
10-
MatInputModule
10+
MatInputModule,
11+
MatMenuModule,
12+
MatButtonModule
1113
} from '@angular/material';
1214
import { RouterModule } from '@angular/router';
1315

@@ -41,7 +43,9 @@ const OPERATOR_ROUTES = [
4143
MatListModule,
4244
MatToolbarModule,
4345
MatCardModule,
44-
MatInputModule
46+
MatInputModule,
47+
MatMenuModule,
48+
MatButtonModule
4549
]
4650
})
4751
export class OperatorsModule { }

src/operator-docs/combination/combineAll.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,40 @@ export const combineAll: OperatorDoc = {
44
'name': 'combineAll',
55
'operatorType': 'combination',
66
'signature': 'public combineAll(project: function): Observable',
7+
'parameters': [
8+
{
9+
'name': 'project',
10+
'type': 'function',
11+
'attribute': 'optional',
12+
'description': 'An optional function to map the most recent values from each inner Observable into a new result. Takes each of the most recent values from each collected inner Observable as arguments, in order.'
13+
}
14+
],
715
'marbleUrl': 'http://reactivex.io/rxjs/img/combineAll.png',
8-
'shortDescription': 'Flattens an Observable-of-Observables by applying <a href="/operators#combineLatest" class="markdown-code">combineLatest</a> when the Observable-of-Observables completes.',
16+
'shortDescription': {
17+
'description': 'Flattens an Observable-of-Observables by applying <a href="/operators#combineLatest" class="markdown-code">combineLatest</a> when the Observable-of-Observables completes.'
18+
},
19+
'longDescription': {
20+
'description': ''
21+
},
922
'examples': [
1023
{
11-
name: 'Map two click events to a finite interval Observable, then apply <span class="markdown-code">combineAll</span>',
12-
code: `
24+
'name': 'Map two click events to a finite interval Observable, then apply <span class="markdown-code">combineAll</span>',
25+
'code': `
1326
const clicks = Rx.Observable.fromEvent(document, 'click');
1427
const higherOrder = clicks.map(ev =>
1528
Rx.Observable.interval(Math.random()*2000).take(3)
1629
).take(2);
1730
const result = higherOrder.combineAll();
1831
result.subscribe(x => console.log(x));
1932
`,
20-
externalLinks: [
21-
{ platform: 'JSBin', url: 'test'}
33+
'externalLinks': [
34+
{ 'platform': 'JSBin', 'url': 'test'},
35+
{ 'platform': 'JSFiddle', 'url': 'test'}
2236
]
2337
}
2438
],
25-
'relatedOperators': [ 'combineLatest', 'mergeAll' ]
39+
'relatedOperators': [ 'combineLatest', 'mergeAll' ],
40+
'additionalResources': [
41+
{ 'description': 'combineAll Tests', 'url': 'http://reactivex.io/rxjs/test-file/spec-js/operators/combineAll-spec.js.html#lineNumber7' }
42+
]
2643
};

src/operator-docs/operator.model.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,39 @@ export interface ExternalLink {
1818
url: string;
1919
}
2020

21+
export interface OperatorParameters {
22+
name: string;
23+
type: string;
24+
attribute: string;
25+
description: string;
26+
}
27+
2128
export interface OperatorExample {
2229
name: string;
2330
code: string;
2431
externalLinks: ExternalLink[];
2532
}
2633

34+
export interface OperatorExtra {
35+
type: 'Tip' | 'Warning';
36+
text: string;
37+
}
38+
2739
export interface OperatorDoc {
2840
readonly name?: string;
2941
readonly operatorType?: OperatorType;
3042
readonly signature?: string;
3143
readonly marbleUrl?: string;
32-
readonly shortDescription?: string;
33-
readonly longDescription?: string;
44+
readonly parameters?: OperatorParameters[];
45+
readonly shortDescription?: {
46+
description: string;
47+
extras?: OperatorExtra[]
48+
};
49+
readonly longDescription?: {
50+
description: string;
51+
extras?: OperatorExtra[]
52+
};
3453
readonly examples?: OperatorExample[];
35-
readonly additionalReferences?: OperatorReference[];
54+
readonly additionalResources?: OperatorReference[];
3655
readonly relatedOperators?: string[];
3756
}

0 commit comments

Comments
 (0)