Skip to content

Commit 4186a2f

Browse files
committed
feat(navigation): add basic navigation component
1 parent 8e7d83d commit 4186a2f

File tree

7 files changed

+61
-2
lines changed

7 files changed

+61
-2
lines changed

src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
<navigation></navigation>
12
<router-outlet></router-outlet>

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { HttpClientModule } from '@angular/common/http';
55

66
import { AppComponent } from './app.component';
77
import { AppRoutingModule } from './app-routing.module';
8+
import { NavigationComponent } from './navigation/navigation.component';
89

910
@NgModule({
1011
declarations: [
11-
AppComponent
12+
AppComponent,
13+
NavigationComponent
1214
],
1315
imports: [
1416
BrowserModule,

src/app/book/book-list/book-list.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
<a [routerLink]="[book.isbn]">{{book.title}}</a>
44
</li>
55
</ul>
6-
<a [routerLink]="['new']">Add new book</a>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<nav class="navbar navbar-dark bg-primary">
2+
<a class="navbar-brand" [routerLink]="['books']">
3+
📖🐵 BookMonkey
4+
</a>
5+
<ul class="navbar-nav mr-auto">
6+
<li class="nav-item active">
7+
<a class="nav-link" [routerLink]="['books']">List all books 📚
8+
<span class="sr-only">(current)</span>
9+
</a>
10+
</li>
11+
</ul>
12+
<span>
13+
<a [routerLink]="['books', 'new']">
14+
<button class="btn btn-success">New Book</button>
15+
</a>
16+
</span>
17+
</nav>

src/app/navigation/navigation.component.scss

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { NavigationComponent } from './navigation.component';
4+
5+
describe('NavigationComponent', () => {
6+
let component: NavigationComponent;
7+
let fixture: ComponentFixture<NavigationComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ NavigationComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(NavigationComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'navigation',
5+
templateUrl: './navigation.component.html',
6+
styleUrls: ['./navigation.component.scss']
7+
})
8+
export class NavigationComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit() {
13+
}
14+
15+
}

0 commit comments

Comments
 (0)