Skip to content

Commit

Permalink
Finally started with angular
Browse files Browse the repository at this point in the history
  • Loading branch information
CerealKiller97 committed Aug 29, 2019
1 parent 441e076 commit fca8160
Show file tree
Hide file tree
Showing 39 changed files with 392 additions and 28 deletions.
4 changes: 3 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"src/assets"
],
"styles": [
"src/custom-theme.scss",
"src/styles.css"
],
"scripts": []
Expand Down Expand Up @@ -115,6 +116,7 @@
}
}
}
}},
}
},
"defaultProject": "video-gamer"
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
"private": true,
"dependencies": {
"@angular/animations": "~8.1.3",
"@angular/cdk": "~8.1.4",
"@angular/common": "~8.1.3",
"@angular/compiler": "~8.1.3",
"@angular/core": "~8.1.3",
"@angular/forms": "~8.1.3",
"@angular/material": "^8.1.4",
"@angular/platform-browser": "~8.1.3",
"@angular/platform-browser-dynamic": "~8.1.3",
"@angular/router": "~8.1.3",
"angular-epic-spinners": "^2.0.0",
"hammerjs": "^2.0.8",
"rxjs": "~6.4.0",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
Expand All @@ -45,4 +48,4 @@
"tslint": "~5.15.0",
"typescript": "~3.4.3"
}
}
}
8 changes: 4 additions & 4 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { VideoGamerLayoutModule } from './modules/layouts/video-gamer-layout/video-gamer-layout.module';
import { Routes, RouterModule, PreloadAllModules } from '@angular/router';

const routes: Routes = [
{
path: '',
loadChildren: () => VideoGamerLayoutModule
loadChildren: () =>
import('./modules/layouts/video-gamer-layout/video-gamer-layout.module').then(mod => mod.VideoGamerLayoutModule)
}
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })],
exports: [RouterModule]
})
export class AppRoutingModule {}
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
AppRoutingModule,
BrowserAnimationsModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>contact works!</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ContactComponent } from './contact.component';

describe('ContactComponent', () => {
let component: ContactComponent;
let fixture: ComponentFixture<ContactComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ContactComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ContactComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/modules/contact/components/contact/contact.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-contact',
templateUrl: './contact.component.html',
styleUrls: ['./contact.component.css']
})
export class ContactComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
18 changes: 18 additions & 0 deletions src/app/modules/contact/contact.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ContactComponent } from './components/contact/contact.component';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
{
path: '',
component: ContactComponent
}
];

@NgModule({
declarations: [ContactComponent],
imports: [CommonModule, RouterModule.forChild(routes)],
exports: [ContactComponent, RouterModule]
})
export class ContactModule {}
Empty file.
1 change: 1 addition & 0 deletions src/app/modules/home/components/home/home.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

25 changes: 25 additions & 0 deletions src/app/modules/home/components/home/home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { HomeComponent } from './home.component';

describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
17 changes: 17 additions & 0 deletions src/app/modules/home/components/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';

@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {

constructor(private readonly titleService: Title) { }

ngOnInit() {
this.titleService.setTitle('Home page');
}

}
19 changes: 19 additions & 0 deletions src/app/modules/home/home.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HomeComponent } from './components/home/home.component';
import { RouterModule, Routes } from '@angular/router';

const routes: Routes = [
{
path: '',
pathMatch: 'full',
component: HomeComponent
}
];

@NgModule({
declarations: [HomeComponent],
imports: [CommonModule, RouterModule.forChild(routes)],
exports: [HomeComponent, RouterModule]
})
export class HomeModule {}
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<app-header></app-header>
<app-loading-spinner></app-loading-spinner>
<router-outlet></router-outlet>
<app-footer></app-footer>
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./default.component.css']
})
export class DefaultComponent implements OnInit {
constructor() {}

constructor() { }

ngOnInit() {
}

ngOnInit() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ const routes: Routes = [
{
path: '',
component: DefaultComponent,
children: []
loadChildren: () => import('../../home/home.module').then(mod => mod.HomeModule)
},
{
path: 'contact',
component: DefaultComponent,
loadChildren: () => import('../../contact/contact.module').then(mod => mod.ContactModule)
},
{
path: '**',
component: null
}
];

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>footer works!</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { FooterComponent } from './footer.component';

describe('FooterComponent', () => {
let component: FooterComponent;
let fixture: ComponentFixture<FooterComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FooterComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.css']
})
export class FooterComponent implements OnInit {
constructor() {}

ngOnInit() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.example-fill-remaining-space {
/* This fills the remaining space, by using flexbox.
Every toolbar row uses a flexbox row layout. */
flex: 1 1 auto;
}

.nav-link {
color: whitesmoke;
}
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
<p>header works!</p>
<mat-toolbar color="primary">
<span>VideoGamer</span>

<span class="example-fill-remaining-space"></span>

<span>
<nav mat-tab-nav-bar>
<button mat-button *ngFor="let link of links" [routerLink]="link.path" routerLinkActive #rla="routerLinkActive"
class="nav-link">
{{ link.name }}
</button>
</nav>
</span>
</mat-toolbar>
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { Component, OnInit } from '@angular/core';

export interface Link {
name: string;
path: string;
}

@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.css']
})
export class HeaderComponent implements OnInit {
public readonly links: Link[] = [
{ name: 'Home', path: '' },
{ name: 'About', path: 'about' },
{ name: 'Contact', path: 'contact' }
];
constructor() {}

constructor() { }
ngOnInit() {}

ngOnInit() {
trackByFunc(index: number, item: Link): string {
return item.path;
}

}
4 changes: 3 additions & 1 deletion src/app/modules/shared-components/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component';

export { HeaderComponent };
export { HeaderComponent, FooterComponent, LoadingSpinnerComponent };
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div *ngIf="loading">
<app-fingerprint-spinner [animationDuration]="1000" [size]="100" [color]="'#ff1d5e'">
</app-fingerprint-spinner>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LoadingSpinnerComponent } from './loading-spinner.component';

describe('LoadingSpinnerComponent', () => {
let component: LoadingSpinnerComponent;
let fixture: ComponentFixture<LoadingSpinnerComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoadingSpinnerComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LoadingSpinnerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, OnInit, Input } from '@angular/core';

@Component({
selector: 'app-loading-spinner',
templateUrl: './loading-spinner.component.html',
styleUrls: ['./loading-spinner.component.css']
})
export class LoadingSpinnerComponent implements OnInit {
@Input() loading: boolean;

constructor() {}

ngOnInit() {}
}
Loading

0 comments on commit fca8160

Please sign in to comment.