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

Commit acea05d

Browse files
committed
operator routing update
1 parent bfb948e commit acea05d

File tree

9 files changed

+17
-14
lines changed

9 files changed

+17
-14
lines changed

src/app/operators/operator/operator-header/operator-header.component.scss renamed to src/app/operators/components/operator-header/operator-header.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
font-size:30px;
33
}
44

5+
.signature {
6+
margin-bottom: 24px;
7+
}
8+
59
mat-toolbar {
610
background: #62757f !important;
711
font-weight: normal;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class="operator-header">
66
</app-operator-header>
77
<div class="main-operator-container">
8-
9-
8+
<div class="short-description">
9+
{{ shortDescription }}
10+
</div>
1011
</div>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
.main-operator-container {
3-
width: 70%;
43
padding: 5px;
54
height: 1000px;
5+
display: flex;
6+
flex-direction: column;
7+
padding: 0 16px;
68
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, Input, OnInit } from '@angular/core';
2-
import { OperatorDoc } from '../../operator-docs/operator.model';
2+
import { OperatorDoc } from '../../../operator-docs/operator.model';
33

44
@Component({
55
selector: 'app-operator',

src/app/operators/operators.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
<h3 mat-subheader class="category-subheader">{{ category }}</h3>
1313
<a mat-list-item
1414
*ngFor="let operator of groupedOperators[category]"
15-
(click)="scrollToOperator(operator.name)"
16-
[routerLink]="[ '/operators', { name: operator.name } ]"
15+
[href]="'/operators#' + operator.name"
1716
[class.active-operator]="(activeOperator$ | async) === operator.name">
1817
{{ operator.name }}
1918
</a>

src/app/operators/operators.component.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Router, ActivatedRoute } from '@angular/router';
33
import { Observable } from 'rxjs/Observable';
44
import { ALL_OPERATORS } from '../operator-docs';
55
import { OperatorDoc } from '../operator-docs/operator.model';
6-
import 'rxjs/add/operator/pluck';
76

87
@Component({
98
selector: 'app-operators',
@@ -22,14 +21,12 @@ export class OperatorsComponent implements OnInit, AfterViewInit {
2221
) { }
2322

2423
ngOnInit() {
25-
this.activeOperator$ = this._activatedRoute
26-
.params
27-
.pluck('name');
24+
this.activeOperator$ = this._activatedRoute.fragment;
2825
}
2926

3027
ngAfterViewInit() {
3128
// scroll initial param when applicable
32-
const { name } = this._activatedRoute.snapshot.params;
29+
const name = this._activatedRoute.snapshot.fragment;
3330

3431
if (name) {
3532
// wait a tick from scroll to be accurate
@@ -38,7 +35,7 @@ export class OperatorsComponent implements OnInit, AfterViewInit {
3835
}
3936

4037
updateUrl(name: string) {
41-
this._router.navigate([ '/operators', { name } ]);
38+
this._router.navigate([ '/operators' ], { fragment: name });
4239
}
4340

4441
scrollToOperator(name: string) {

src/app/operators/operators.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { MatSidenavModule, MatIconModule, MatListModule, MatToolbarModule } from
44
import { RouterModule } from '@angular/router';
55

66
import { OperatorsComponent } from './operators.component';
7-
import { OperatorComponent } from './operator/operator.component';
8-
import { OperatorHeaderComponent } from './operator/operator-header/operator-header.component';
7+
import { OperatorComponent } from './components/operator/operator.component';
8+
import { OperatorHeaderComponent } from './components/operator-header/operator-header.component';
99

1010
import { OperatorScrollDirective } from './directives/operator-scroll.directive';
1111
import { HighlightJsDirective } from './directives/highlight-js.directive';

0 commit comments

Comments
 (0)