-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add todos, lazy reducer, big input custom component
- Loading branch information
1 parent
81c25a0
commit 878662e
Showing
37 changed files
with
522 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './local-storage/local-storage.service'; | ||
export * from './local-storage/local-storage.middleware'; | ||
export * from './core.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
|
||
import { CoreModule } from '../core'; | ||
import { CoreModule, createReducer } from '../core'; | ||
import { SharedModule } from '../shared'; | ||
|
||
import { ExamplesRoutingModule } from './examples-routing.module'; | ||
import { TodosComponent } from './todos/todos.component'; | ||
import { ExamplesComponent } from './examples/examples.component'; | ||
import { StockMarketComponent } from './stock-market/stock-market.component'; | ||
import { StockMarketService } from './stock-market/stock-market.service'; | ||
|
||
import { todosReducer } from './todos/todos.reducer'; | ||
|
||
export const appReducerWithExamples = createReducer({ | ||
todos: todosReducer | ||
}); | ||
|
||
@NgModule({ | ||
imports: [ | ||
CoreModule, | ||
SharedModule, | ||
ExamplesRoutingModule | ||
], | ||
declarations: [TodosComponent] | ||
declarations: [TodosComponent, ExamplesComponent, StockMarketComponent], | ||
providers: [StockMarketService] | ||
}) | ||
export class ExamplesModule { } | ||
export class ExamplesModule { | ||
|
||
constructor(private store: Store<any> ) { | ||
store.replaceReducer(appReducerWithExamples); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<nav md-tab-nav-bar> | ||
<a md-tab-link | ||
*ngFor="let e of examples" | ||
[routerLink]="e.link" | ||
routerLinkActive #rla="routerLinkActive" | ||
[active]="rla.isActive"> | ||
{{e.label}} | ||
</a> | ||
</nav> | ||
<router-outlet></router-outlet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nav { | ||
margin-bottom: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { SharedModule } from '../../shared'; | ||
import { CoreModule } from '../../core'; | ||
|
||
import { ExamplesComponent } from './examples.component'; | ||
|
||
describe('ExamplesComponent', () => { | ||
let component: ExamplesComponent; | ||
let fixture: ComponentFixture<ExamplesComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
RouterTestingModule, | ||
SharedModule, | ||
CoreModule | ||
], | ||
declarations: [ ExamplesComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ExamplesComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'anms-examples', | ||
templateUrl: './examples.component.html', | ||
styleUrls: ['./examples.component.scss'] | ||
}) | ||
export class ExamplesComponent implements OnInit { | ||
|
||
examples = [ | ||
{ link: 'todos', label: 'Todos' }, | ||
{ link: 'stock-market', label: 'Stock Market' }, | ||
]; | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p> | ||
stock-market works! | ||
</p> |
Empty file.
25 changes: 25 additions & 0 deletions
25
src/app/examples/stock-market/stock-market.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { StockMarketComponent } from './stock-market.component'; | ||
|
||
describe('StockMarketComponent', () => { | ||
let component: StockMarketComponent; | ||
let fixture: ComponentFixture<StockMarketComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ StockMarketComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(StockMarketComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'anms-stock-market', | ||
templateUrl: './stock-market.component.html', | ||
styleUrls: ['./stock-market.component.scss'] | ||
}) | ||
export class StockMarketComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/app/examples/stock-market/stock-market.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { TestBed, inject } from '@angular/core/testing'; | ||
|
||
import { StockMarketService } from './stock-market.service'; | ||
|
||
describe('StockMarketService', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [StockMarketService] | ||
}); | ||
}); | ||
|
||
it('should be created', inject([StockMarketService], (service: StockMarketService) => { | ||
expect(service).toBeTruthy(); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable() | ||
export class StockMarketService { | ||
|
||
constructor() { } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,42 @@ | ||
<p> | ||
todos works! | ||
</p> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="offset-md-2 col-md-8 entry"> | ||
<anms-big-input placeholder="I want to do..." | ||
[value]="newTodo" | ||
(keyup)="onNewTodoChange($event.target.value)" | ||
(keyup.enter)="onAddTodo()"> | ||
<anms-big-input-action icon="add" color="accent" | ||
(click)="onAddTodo()" | ||
[disabled]="newTodo.length < 4"> | ||
</anms-big-input-action> | ||
<anms-big-input-action icon="delete_forever" disabled></anms-big-input-action> | ||
</anms-big-input> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<h2>Todo List</h2> | ||
<md-card *ngFor="let todo of todos.items" class="todo"> | ||
{{todo.name}} | ||
</md-card> | ||
<br> | ||
</div> | ||
<div class="offset-md-1 col-md-5"> | ||
<h2>Todo Example</h2> | ||
<p> | ||
This is a classic <code>todo</code> example with support for | ||
adding, toggling, removing and filtering of the todo items. | ||
</p> | ||
<p> | ||
State handling is implemented using <code>ngrx</code> module | ||
and support for lazy loaded reducers (this is a lazy loaded feature module). | ||
</p> | ||
<p> | ||
Todos are persisted into local storage so you should see your todos | ||
also on later visits when using the same browser. | ||
</p> | ||
<br> | ||
</div> | ||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.entry { | ||
margin-top: 40px; | ||
margin-bottom: 40px; | ||
} | ||
|
||
.todo { | ||
margin-bottom: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.