mirror of
https://github.com/Raghu-Ch/InventoryManagement.git
synced 2026-02-10 04:13:02 -05:00
Add home & login component with routing
This commit is contained in:
20
src/app/app-routing.module.ts
Normal file
20
src/app/app-routing.module.ts
Normal file
@@ -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 { }
|
||||
@@ -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%;
|
||||
}
|
||||
|
||||
.active {
|
||||
background: #424242;
|
||||
border-radius: 25%;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<nav>
|
||||
<ul class="nav_header">
|
||||
<li>
|
||||
<a href="#">Home</a>
|
||||
<a routerLink="/home" routerLinkActive="active">Home</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">Products</a>
|
||||
@@ -14,29 +14,12 @@
|
||||
<a href="#">Add Product</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">LogIn</a>
|
||||
<a routerLink="/login" routerLinkActive="active">LogIn</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</mat-toolbar-row>
|
||||
</mat-toolbar>
|
||||
<div class="container ">
|
||||
<mat-card>
|
||||
<mat-tab-group>
|
||||
<mat-tab label="About">
|
||||
<div class="demo-tab-content">
|
||||
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.
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="Dashboard">
|
||||
<div class="demo-tab-content">
|
||||
Content 2
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</mat-card>
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
|
||||
@@ -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]
|
||||
|
||||
4
src/app/home/home.component.css
Normal file
4
src/app/home/home.component.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.demo-tab-content {
|
||||
color: white;
|
||||
padding: 16px;
|
||||
}
|
||||
18
src/app/home/home.component.html
Normal file
18
src/app/home/home.component.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<mat-card>
|
||||
<mat-tab-group>
|
||||
<mat-tab label="About">
|
||||
<div class="demo-tab-content">
|
||||
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.
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="Dashboard">
|
||||
<div class="demo-tab-content">
|
||||
Content 2
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</mat-card>
|
||||
25
src/app/home/home.component.spec.ts
Normal file
25
src/app/home/home.component.spec.ts
Normal file
@@ -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();
|
||||
});
|
||||
});
|
||||
15
src/app/home/home.component.ts
Normal file
15
src/app/home/home.component.ts
Normal file
@@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
4
src/app/login/login.component.css
Normal file
4
src/app/login/login.component.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.demo-tab-content {
|
||||
color: white;
|
||||
padding: 16px;
|
||||
}
|
||||
3
src/app/login/login.component.html
Normal file
3
src/app/login/login.component.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<p class="demo-tab-content">
|
||||
login works!
|
||||
</p>
|
||||
25
src/app/login/login.component.spec.ts
Normal file
25
src/app/login/login.component.spec.ts
Normal file
@@ -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<LoginComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoginComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoginComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
15
src/app/login/login.component.ts
Normal file
15
src/app/login/login.component.ts
Normal file
@@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
10
src/app/not-found.component.ts
Normal file
10
src/app/not-found.component.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<div>
|
||||
<h2>404 Page not found !!</h2>
|
||||
</div>`,
|
||||
styles: [`h2 {font-size: 32px; color: white; text-align: center;}`]
|
||||
})
|
||||
export class PageNotFoundComponent { }
|
||||
@@ -4,6 +4,7 @@
|
||||
* {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #212121;
|
||||
box-sizing: border-box;
|
||||
|
||||
Reference in New Issue
Block a user