feat: add not found component (#327)

Fixes #110
This commit is contained in:
Jonathan Xu
2018-11-18 14:46:43 +05:30
committed by Abhay Chawla
parent dffce8a5e0
commit 2feee9d8a2
9 changed files with 197 additions and 51 deletions
+4 -2
View File
@@ -2,14 +2,16 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
// Not Found Component
import {NotFoundComponent} from './not-found/not-found.component';
/**
* Fallback to this route when no prior route is matched.
*/
const routes: Routes = [
{
path: '**',
redirectTo: '',
pathMatch: 'full'
component: NotFoundComponent
}
];
+4 -1
View File
@@ -17,6 +17,9 @@ import { environment } from 'environments/environment';
/** Main Component */
import { WebAppComponent } from './web-app.component';
/** Not Found Component */
import { NotFoundComponent } from './not-found/not-found.component';
/** Custom Modules */
import { CoreModule } from './core/core.module';
import { HomeModule } from './home/home.module';
@@ -59,7 +62,7 @@ import { AppRoutingModule } from './app-routing.module';
SystemModule,
AppRoutingModule
],
declarations: [WebAppComponent],
declarations: [WebAppComponent, NotFoundComponent],
providers: [],
bootstrap: [WebAppComponent]
})
@@ -0,0 +1,5 @@
<div id="particles-js"></div>
<div class="text">
<h1 id="title">404</h1>
<p id="subtitle">Something went wrong.</p>
</div>
@@ -0,0 +1,28 @@
#particles-js {
position: absolute;
width: 100%;
height: 100%;
background: cornflowerblue;
}
.text {
position: absolute;
top: 50%;
right: 50%;
transform: translate(50%,-50%);
max-width: 90%;
padding: 2em 3em;
color: white;
font-family: 'Raleway', sans-serif;
display: flex;
flex-direction: column;
align-items: center;
}
#title {
font-size: 120pt;
}
#subtitle {
font-size: 12pt;
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NotFoundComponent } from './not-found.component';
describe('NotFoundComponent', () => {
let component: NotFoundComponent;
let fixture: ComponentFixture<NotFoundComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NotFoundComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NotFoundComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
+17
View File
@@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
declare var particlesJS: any;
@Component({
selector: 'mifosx-not-found',
templateUrl: './not-found.component.html',
styleUrls: ['./not-found.component.scss']
})
export class NotFoundComponent implements OnInit {
constructor() { }
ngOnInit() {
particlesJS.load('particles-js', '/assets/particles.json');
}
}