Skip to content

Commit 452a2f9

Browse files
author
Armen Vardanyan
committed
Content
1 parent f65d37f commit 452a2f9

26 files changed

+684
-13
lines changed

.angulardoc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"repoId": "d8b7b3b9-cad2-4cc3-9282-b3ca4a899e28",
3+
"lastSync": 0
4+
}

angular.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
"styles": [
3131
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
3232
"src/styles.scss",
33-
"node_modules/prismjs/themes/prism-dark.css",
33+
"node_modules/prismjs/themes/prism-okaidia.css",
3434
"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
3535
],
3636
"scripts": [
3737
"node_modules/marked/lib/marked.js",
3838
"node_modules/prismjs/prism.js",
3939
"node_modules/prismjs/components/prism-typescript.min.js",
40+
"node_modules/prismjs/components/prism-bash.min.js",
4041
"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js"
4142
]
4243
},

package-lock.json

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/app.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<mat-sidenav-container>
22
<mat-sidenav [opened]="sidebarOpen" (closedStart)="sidebarOpen = false">
3-
Start
3+
<p *ngFor="let chapter of chapters; let i = index" [routerLink]="['/chapter', i + 1]">
4+
<a>{{ chapter }}</a>
5+
</p>
46
</mat-sidenav>
57
<mat-sidenav-content>
68
<mat-toolbar>

src/app/app.component.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
2+
import { NavigationEnd, Router } from '@angular/router';
3+
import { filter } from 'rxjs/operators';
24

35
@Component({
46
selector: 'app-root',
57
templateUrl: './app.component.html',
68
styleUrls: ['./app.component.scss']
79
})
8-
export class AppComponent {
10+
export class AppComponent implements OnInit {
911
title = 'ngrx-tutorial';
1012
sidebarOpen = false;
13+
chapters = [
14+
'Introduction to NgRx',
15+
'Getting started: Installing dependencies and creating the project',
16+
'NgRx: the What',
17+
'NgRx: the Why',
18+
'Actions',
19+
'Reducers',
20+
];
21+
22+
constructor(
23+
private readonly router: Router
24+
) {}
25+
26+
ngOnInit() {
27+
this.router.events.pipe(
28+
filter(event => event instanceof NavigationEnd),
29+
).subscribe(() => window.scrollTo({top: 0, behavior: 'smooth'}));
30+
}
1131
}

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ import { AppComponent } from './app.component';
1111
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
1212
import { ChaptersComponent } from './chapters/chapters.component';
1313
import { HttpClientModule } from '@angular/common/http';
14+
import { HomeworkComponent } from './homework/homework.component';
1415

1516
@NgModule({
1617
declarations: [
1718
AppComponent,
1819
ChaptersComponent,
20+
HomeworkComponent,
1921
],
2022
imports: [
2123
BrowserModule,
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<div class="chapter">
2-
<markdown [src]="chapterPath$ | async"></markdown>
2+
<markdown [src]="chapterPath$ | async" lineNumbers></markdown>
3+
<app-homework [chapterNumber]="chapterNumber$ | async"></app-homework>
34
<a [routerLink]="nextChapterUrl$ | async">Next chapter</a>.
45
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.chapter {
22
width: 80%;
3+
height: 100%;
34
margin: auto;
45
}

src/app/chapters/chapters.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ import { map } from 'rxjs/operators';
99
})
1010
export class ChaptersComponent implements OnInit {
1111

12-
chapterPath$ = this.route.paramMap.pipe(
12+
chapterNumber$ = this.route.paramMap.pipe(
1313
map(params => params.get('chapter')),
14-
map(chapter => `assets/content/chapter-${chapter}.md`),
14+
);
15+
16+
chapterPath$ = this.chapterNumber$.pipe(
17+
map(chapter => `assets/content/chapters/chapter-${chapter}.md`),
1518
);
1619

1720
nextChapterUrl$ = this.route.paramMap.pipe(

src/app/homework/homework.component.scss

Whitespace-only changes.

0 commit comments

Comments
 (0)