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

Commit 68a52b1

Browse files
committed
added copy + operator styling updates
1 parent 6c7f2c4 commit 68a52b1

File tree

12 files changed

+98
-14
lines changed

12 files changed

+98
-14
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@types/hammerjs": "2.0.35",
2828
"core-js": "2.4.1",
2929
"hammerjs": "2.0.8",
30+
"ngx-clipboard": "8.1.0",
3031
"rxjs": "5.4.2",
3132
"zone.js": "0.8.14"
3233
},

src/app/operators/_operator-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $link-color: #2196F3;
3838
}
3939
}
4040

41-
a {
41+
app-operator a {
4242
text-decoration: none;
4343
color: $link-color;
4444
}

src/app/operators/components/additional-resources/additional-resources.component.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ <h2> Additional Resources </h2>
33
<li>
44
<a [href]="sourceUrl" target="_blank"> Source Code </a>
55
</li>
6+
<li>
7+
<a [href]="specUrl" target="_blank"> Specs </a>
8+
</li>
69
<li *ngFor="let resource of additionalResources">
7-
<a [href]="resource.url" target="_blank"> {{ resource.name }} </a>
10+
<a [href]="resource.url" target="_blank"> {{ resource.description }} </a>
811
</li>
9-
</ul>
12+
</ul>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ <h3 [innerHTML]="example.name"></h3>
1616
*ngFor="let link of example.externalLinks">
1717
{{link.platform}}
1818
</a>
19+
<span
20+
mat-menu-item
21+
ngxClipboard
22+
[cbContent]="example.code">
23+
Copy To Clipboard
24+
</span>
1925
</mat-menu>
2026
<pre [innerHTML]="example.code"></pre>
2127
</div>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<div
2+
class="extra-tip"
3+
*ngFor="let tip of tips">
4+
<mat-icon class="tip-info">info</mat-icon>
5+
<h3 [innerHTML]="tip.text"></h3>
6+
</div>
7+
<div
8+
class="extra-tip"
9+
*ngFor="let warning of warnings">
10+
<mat-icon class="tip-warning">warning</mat-icon>
11+
<h3 [innerHTML]="warning.text"></h3>
12+
</div>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
h3 {
2+
display: inline-block;
3+
vertical-align: middle;
4+
padding-left: 10px;
5+
}
6+
7+
.tip-warning {
8+
color: rgb(244, 67, 54);
9+
}
10+
11+
.tip-info {
12+
color: rgb(33, 150, 243);
13+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Component, Input } from '@angular/core';
2+
import { OperatorExtra } from '../../../../operator-docs';
3+
4+
@Component({
5+
selector: 'app-operator-extras',
6+
templateUrl: './operator-extras.component.html',
7+
styleUrls: ['./operator-extras.component.scss']
8+
})
9+
export class OperatorExtrasComponent {
10+
@Input() operatorExtras: OperatorExtra[] = [];
11+
12+
get tips() {
13+
return this.operatorExtras.filter(e => e.type === 'Tip');
14+
}
15+
16+
get warnings() {
17+
return this.operatorExtras.filter(e => e.type === 'Warning');
18+
}
19+
}

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

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,28 @@
66
</app-operator-header>
77
<section class="main-operator-container mat-typography">
88
<h3 class="short-description" [innerHTML]="shortDescription"></h3>
9-
<app-marble-diagram [url]="marbleUrl" class="margin-bottom-32"></app-marble-diagram>
10-
<app-operator-examples [operatorExamples]="examples" class="margin-bottom-16"></app-operator-examples>
11-
<app-operator-parameters [operatorParameters]="parameters"></app-operator-parameters>
12-
<app-operator-walkthrough [operatorWalkthrough]="walkthrough" class="margin-bottom-16"></app-operator-walkthrough>
13-
<app-related-operators [relatedOperators]="relatedOperators"></app-related-operators>
9+
<app-operator-extras
10+
class="margin-bottom-16"
11+
*ngIf="shortDescriptionExtras"
12+
[operatorExtras]="shortDescriptionExtras">
13+
</app-operator-extras>
14+
<app-marble-diagram
15+
class="margin-bottom-32"
16+
[url]="marbleUrl" >
17+
</app-marble-diagram>
18+
<app-operator-examples
19+
[operatorExamples]="examples" class="margin-bottom-16">
20+
</app-operator-examples>
21+
<app-operator-parameters
22+
[operatorParameters]="parameters">
23+
</app-operator-parameters>
24+
<app-operator-walkthrough
25+
class="margin-bottom-16"
26+
[operatorWalkthrough]="walkthrough" >
27+
</app-operator-walkthrough>
28+
<app-related-operators
29+
[relatedOperators]="relatedOperators">
30+
</app-related-operators>
1431
<app-additional-resources
1532
[additionalResources]="additionalResources"
1633
[sourceUrl]="sourceUrl">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
display: flex;
44
flex-direction: column;
55
padding: 0 16px;
6-
margin-bottom: 16px;
6+
margin-bottom: 32px;
77
}
88

99
.short-description {

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class OperatorComponent {
1111
@Input() operator: OperatorDoc;
1212

1313
private readonly baseSourceUrl = 'https://github.com/ReactiveX/rxjs/blob/master/src/operators/';
14+
private readonly baseSpecUrl = 'http://reactivex.io/rxjs/test-file/spec-js/operators';
1415

1516
get operatorName() {
1617
return this.operator.name;
@@ -28,6 +29,10 @@ export class OperatorComponent {
2829
return this.operator.shortDescription && this.operator.shortDescription.description;
2930
}
3031

32+
get shortDescriptionExtras() {
33+
return this.operator.shortDescription && this.operator.shortDescription.extras;
34+
}
35+
3136
get walkthrough() {
3237
return this.operator.walkthrough && this.operator.walkthrough.description;
3338
}
@@ -48,6 +53,10 @@ export class OperatorComponent {
4853
return `${this.baseSourceUrl}/${this.operatorName}.ts`;
4954
}
5055

56+
get specUrl() {
57+
return `${this.baseSpecUrl}/${this.operatorName}-spec.js.html`;
58+
}
59+
5160
get additionalResources() {
5261
return this.operator.additionalResources || [];
5362
}

0 commit comments

Comments
 (0)