From 174d1cb327fe882b131ad7050b8203a286f54816 Mon Sep 17 00:00:00 2001 From: Raghu-Ch Date: Fri, 1 Jun 2018 17:54:55 -0400 Subject: [PATCH] Add home & login component with routing --- src/app/app-routing.module.ts | 20 ++++++++++++++++++++ src/app/app.component.css | 21 +++++++++++++++------ src/app/app.component.html | 25 ++++--------------------- src/app/app.module.ts | 12 ++++++++++-- src/app/home/home.component.css | 4 ++++ src/app/home/home.component.html | 18 ++++++++++++++++++ src/app/home/home.component.spec.ts | 25 +++++++++++++++++++++++++ src/app/home/home.component.ts | 15 +++++++++++++++ src/app/login/login.component.css | 4 ++++ src/app/login/login.component.html | 3 +++ src/app/login/login.component.spec.ts | 25 +++++++++++++++++++++++++ src/app/login/login.component.ts | 15 +++++++++++++++ src/app/not-found.component.ts | 10 ++++++++++ src/styles.css | 3 ++- 14 files changed, 170 insertions(+), 30 deletions(-) create mode 100644 src/app/app-routing.module.ts create mode 100644 src/app/home/home.component.css create mode 100644 src/app/home/home.component.html create mode 100644 src/app/home/home.component.spec.ts create mode 100644 src/app/home/home.component.ts create mode 100644 src/app/login/login.component.css create mode 100644 src/app/login/login.component.html create mode 100644 src/app/login/login.component.spec.ts create mode 100644 src/app/login/login.component.ts create mode 100644 src/app/not-found.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts new file mode 100644 index 0000000..ec792c9 --- /dev/null +++ b/src/app/app-routing.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +import { HomeComponent } from './home/home.component'; +import { LoginComponent } from './login/login.component'; +import { PageNotFoundComponent } from './not-found.component'; + +const routes: Routes = [ + { path: 'home', component: HomeComponent }, + { path: 'login', component: LoginComponent }, + { path: '', redirectTo: '/home', pathMatch: 'full' }, + { path: '**', component: PageNotFoundComponent } +]; + +@NgModule({ + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule] +}) + +export class AppRoutingModule { } diff --git a/src/app/app.component.css b/src/app/app.component.css index 730f1c8..ceb8309 100644 --- a/src/app/app.component.css +++ b/src/app/app.component.css @@ -4,7 +4,8 @@ } nav { - margin-left: 26px; + margin-left: 25px; + width: 100% !important; } .nav_header { @@ -15,6 +16,11 @@ nav { .nav_header li { float: left; + padding: .2em; +} + +.nav_header li:last-child { + float: right; } li a { @@ -26,12 +32,15 @@ li a { li a:hover { background: #424242; + /* color: #e91e63; */ } -.demo-tab-content { - color: white; - padding: 16px; -} + .container { margin: 2em auto; width: 70%; -} \ No newline at end of file +} + +.active { + background: #424242; + border-radius: 25%; +} diff --git a/src/app/app.component.html b/src/app/app.component.html index ea5f359..1757c61 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -5,7 +5,7 @@ -
- - - -
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy - text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen - book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially - unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, - and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. -
-
- -
- Content 2 -
-
-
-
+
+
diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 311c9aa..aaae50b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,17 +2,25 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppMaterialModule } from './app-material.module'; +import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; +import { PageNotFoundComponent } from './not-found.component'; +import { HomeComponent } from './home/home.component'; +import { LoginComponent } from './login/login.component'; @NgModule({ declarations: [ - AppComponent + AppComponent, + PageNotFoundComponent, + HomeComponent, + LoginComponent ], imports: [ BrowserModule, BrowserAnimationsModule, - AppMaterialModule + AppMaterialModule, + AppRoutingModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/home/home.component.css b/src/app/home/home.component.css new file mode 100644 index 0000000..416cb84 --- /dev/null +++ b/src/app/home/home.component.css @@ -0,0 +1,4 @@ +.demo-tab-content { + color: white; + padding: 16px; +} diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html new file mode 100644 index 0000000..01a229c --- /dev/null +++ b/src/app/home/home.component.html @@ -0,0 +1,18 @@ + + + +
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy + text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen + book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially + unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and + more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. +
+
+ +
+ Content 2 +
+
+
+
diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts new file mode 100644 index 0000000..490e81b --- /dev/null +++ b/src/app/home/home.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts new file mode 100644 index 0000000..33fd770 --- /dev/null +++ b/src/app/home/home.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.css'] +}) +export class HomeComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/login/login.component.css b/src/app/login/login.component.css new file mode 100644 index 0000000..416cb84 --- /dev/null +++ b/src/app/login/login.component.css @@ -0,0 +1,4 @@ +.demo-tab-content { + color: white; + padding: 16px; +} diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html new file mode 100644 index 0000000..79112a0 --- /dev/null +++ b/src/app/login/login.component.html @@ -0,0 +1,3 @@ +

+ login works! +

diff --git a/src/app/login/login.component.spec.ts b/src/app/login/login.component.spec.ts new file mode 100644 index 0000000..d6d85a8 --- /dev/null +++ b/src/app/login/login.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LoginComponent } from './login.component'; + +describe('LoginComponent', () => { + let component: LoginComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ LoginComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(LoginComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts new file mode 100644 index 0000000..5701fa2 --- /dev/null +++ b/src/app/login/login.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-login', + templateUrl: './login.component.html', + styleUrls: ['./login.component.css'] +}) +export class LoginComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/not-found.component.ts b/src/app/not-found.component.ts new file mode 100644 index 0000000..20321ee --- /dev/null +++ b/src/app/not-found.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + template: ` +
+

404 Page not found !!

+
`, + styles: [`h2 {font-size: 32px; color: white; text-align: center;}`] +}) +export class PageNotFoundComponent { } diff --git a/src/styles.css b/src/styles.css index 2289ffb..fe25b6a 100644 --- a/src/styles.css +++ b/src/styles.css @@ -4,7 +4,8 @@ * { margin: 0; } + body { background: #212121; box-sizing: border-box; -} \ No newline at end of file +}