Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": []
Expand Down Expand Up @@ -83,6 +84,7 @@
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": [],
Expand Down
5 changes: 4 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~7.0.0",
"@angular/animations": "^7.0.4",
"@angular/cdk": "^7.2.1",
"@angular/common": "~7.0.0",
"@angular/compiler": "~7.0.0",
"@angular/core": "~7.0.0",
"@angular/forms": "~7.0.0",
"@angular/http": "~7.0.0",
"@angular/material": "^7.2.1",
"@angular/platform-browser": "~7.0.0",
"@angular/platform-browser-dynamic": "~7.0.0",
"@angular/router": "~7.0.0",
"core-js": "^2.5.4",
"hammerjs": "^2.0.8",
"rxjs": "~6.3.3",
"zone.js": "~0.8.26"
},
Expand Down
13 changes: 11 additions & 2 deletions client/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<!-- <div style="text-align:center">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Incomplete <!-- is the cause of your error as you haven't closed this comment, remove this.

<h1>
Welcome to {{ title }}!
</h1>
Expand All @@ -18,4 +18,13 @@ <h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular bl
</li>
</ul>

<router-outlet></router-outlet>
<router-outlet></router-outlet> -->
<my-nav>
<router-outlet></router-outlet>

</my-nav>
<footer >
<div layout="row" layout-align="center center" align="center">
<h2>Footer</h2>
</div>
</footer>
24 changes: 22 additions & 2 deletions client/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,34 @@ import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MyNavComponent } from './my-nav/my-nav.component';
import { MyDashComponent } from './my-dash/my-dash.component';
import { LayoutModule } from '@angular/cdk/layout';
import { MatToolbarModule, MatButtonModule, MatSidenavModule, MatIconModule, MatListModule } from '@angular/material';
import { MyOwnCustomMaterialModule } from './material';
import { Routes, RouterModule } from '@angular/router'

const appRoutes: Routes= [
{path: '', component: MyDashComponent}
]
Copy link
Member

@aashish-ak aashish-ak Jan 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in the AppRoutingModule, all components should be there in the app-routing.module.ts file as the path is the url you want for that component and component is the component you want to load whenever the corresponding path is accessed.


@NgModule({
declarations: [
AppComponent
AppComponent,
MyNavComponent,
],
imports: [
BrowserModule,
AppRoutingModule
AppRoutingModule,
BrowserAnimationsModule,
LayoutModule,
MatToolbarModule,
MatButtonModule,
MatSidenavModule,
MatIconModule,
MatListModule,
// RouterModule.forRoot(appRoutes),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this and add it in the app routing module file.

],
providers: [],
bootstrap: [AppComponent]
Expand Down
8 changes: 8 additions & 0 deletions client/src/app/material.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {MatButtonModule, MatCheckboxModule, MatCardModule} from '@angular/material';
import { NgModule } from '@angular/core'

@NgModule({
imports: [MatButtonModule, MatCheckboxModule, MatCardModule],
exports: [MatButtonModule, MatCheckboxModule, MatCardModule],
})
export class MyOwnCustomMaterialModule { }
24 changes: 24 additions & 0 deletions client/src/app/my-dash/my-dash.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="grid-container">
<h1 class="mat-h1">Dashboard</h1>
<mat-grid-list cols="2" rowHeight="350px">
<mat-grid-tile *ngFor="let card of cards | async" [colspan]="card.cols" [rowspan]="card.rows">
<mat-card class="dashboard-card">
<mat-card-header>
<mat-card-title>
{{card.title}}
<button mat-icon-button class="more-button" [matMenuTriggerFor]="menu" aria-label="Toggle menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu" xPosition="before">
<button mat-menu-item>Expand</button>
<button mat-menu-item>Remove</button>
</mat-menu>
</mat-card-title>
</mat-card-header>
<mat-card-content class="dashboard-card-content">
<div>Card Content Here</div>
</mat-card-content>
</mat-card>
</mat-grid-tile>
</mat-grid-list>
</div>
21 changes: 21 additions & 0 deletions client/src/app/my-dash/my-dash.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.grid-container {
margin: 20px;
}

.dashboard-card {
position: absolute;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
}

.more-button {
position: absolute;
top: 5px;
right: 10px;
}

.dashboard-card-content {
text-align: center;
}
42 changes: 42 additions & 0 deletions client/src/app/my-dash/my-dash.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { LayoutModule } from '@angular/cdk/layout';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {
MatButtonModule,
MatCardModule,
MatGridListModule,
MatIconModule,
MatMenuModule,
} from '@angular/material';

import { MyDashComponent } from './my-dash.component';

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

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MyDashComponent],
imports: [
NoopAnimationsModule,
LayoutModule,
MatButtonModule,
MatCardModule,
MatGridListModule,
MatIconModule,
MatMenuModule,
]
}).compileComponents();
}));

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

it('should compile', () => {
expect(component).toBeTruthy();
});
});
33 changes: 33 additions & 0 deletions client/src/app/my-dash/my-dash.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Component } from '@angular/core';
import { map } from 'rxjs/operators';
import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout';

@Component({
selector: 'my-dash',
templateUrl: './my-dash.component.html',
styleUrls: ['./my-dash.component.scss']
})
export class MyDashComponent {
/** Based on the screen size, switch from standard to one column per row */
cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
if (matches) {
return [
{ title: 'Card 1', cols: 1, rows: 1 },
{ title: 'Card 2', cols: 1, rows: 1 },
{ title: 'Card 3', cols: 1, rows: 1 },
{ title: 'Card 4', cols: 1, rows: 1 }
];
}

return [
{ title: 'Card 1', cols: 2, rows: 1 },
{ title: 'Card 2', cols: 1, rows: 1 },
{ title: 'Card 3', cols: 1, rows: 2 },
{ title: 'Card 4', cols: 1, rows: 1 }
];
})
);

constructor(private breakpointObserver: BreakpointObserver) {}
}
29 changes: 29 additions & 0 deletions client/src/app/my-nav/my-nav.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<mat-sidenav-container class="sidenav-container">
<mat-sidenav #drawer class="sidenav" fixedInViewport="true"
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'"
[mode]="(isHandset$ | async) ? 'over' : 'side'"
[opened]="!(isHandset$ | async)">
<mat-toolbar>Menu</mat-toolbar>
<mat-nav-list>
<a mat-list-item href="#">Link 1</a>
<a mat-list-item href="#">Link 2</a>
<a mat-list-item href="#">Link 3</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<mat-toolbar color="primary" class = "fixed-toolbar">
<button
type="button"
aria-label="Toggle sidenav"
mat-icon-button
(click)="drawer.toggle()"
*ngIf="isHandset$ | async">
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
<span>client</span>
</mat-toolbar>
<!-- Add Content Here -->
<ng-content></ng-content>
</mat-sidenav-content>

</mat-sidenav-container>
22 changes: 22 additions & 0 deletions client/src/app/my-nav/my-nav.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.sidenav-container {
height: 100%;
}

.sidenav {
width: 200px;
box-shadow: 3px 0 6px rgba(0,0,0,.24);
}

.sidenav .mat-toolbar {
background: inherit;
}

.mat-toolbar.mat-primary {
position: sticky;
top: 0;
z-index: 1;
}
.fixed-toolbar{
position: fixed;
z-index: 2;
}
42 changes: 42 additions & 0 deletions client/src/app/my-nav/my-nav.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { LayoutModule } from '@angular/cdk/layout';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import {
MatButtonModule,
MatIconModule,
MatListModule,
MatSidenavModule,
MatToolbarModule,
} from '@angular/material';

import { MyNavComponent } from './my-nav.component';

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

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MyNavComponent],
imports: [
NoopAnimationsModule,
LayoutModule,
MatButtonModule,
MatIconModule,
MatListModule,
MatSidenavModule,
MatToolbarModule,
]
}).compileComponents();
}));

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

it('should compile', () => {
expect(component).toBeTruthy();
});
});
20 changes: 20 additions & 0 deletions client/src/app/my-nav/my-nav.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Component } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

@Component({
selector: 'my-nav',
templateUrl: './my-nav.component.html',
styleUrls: ['./my-nav.component.scss']
})
export class MyNavComponent {

isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
.pipe(
map(result => result.matches)
);

constructor(private breakpointObserver: BreakpointObserver) {}

}
2 changes: 2 additions & 0 deletions client/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<app-root></app-root>
Expand Down
1 change: 1 addition & 0 deletions client/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'hammerjs';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

Expand Down
4 changes: 4 additions & 0 deletions client/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/* You can add global styles to this file, and also import other style files */

@import "~@angular/material/prebuilt-themes/indigo-pink.css";
html, body { height: 100%; }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "A MEAN Stack online platform to help provide medical facilities and knowledge online.",
"main": "app.js",
"scripts": {
"start": "node lib/server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "kamandPrompt",
Expand Down