diff --git a/client/angular.json b/client/angular.json index 41c7b04..536fb08 100644 --- a/client/angular.json +++ b/client/angular.json @@ -27,6 +27,7 @@ "src/assets" ], "styles": [ + "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.scss" ], "scripts": [] @@ -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": [], diff --git a/client/package.json b/client/package.json index 2c84af8..7b8279b 100644 --- a/client/package.json +++ b/client/package.json @@ -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" }, diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html index 1094e7e..9a31a85 100644 --- a/client/src/app/app.component.html +++ b/client/src/app/app.component.html @@ -1,5 +1,5 @@ -
+ + + + + + diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 2c3ba29..9df1fec 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -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} +] @NgModule({ declarations: [ - AppComponent + AppComponent, + MyNavComponent, ], imports: [ BrowserModule, - AppRoutingModule + AppRoutingModule, + BrowserAnimationsModule, + LayoutModule, + MatToolbarModule, + MatButtonModule, + MatSidenavModule, + MatIconModule, + MatListModule, + // RouterModule.forRoot(appRoutes), ], providers: [], bootstrap: [AppComponent] diff --git a/client/src/app/material.ts b/client/src/app/material.ts new file mode 100644 index 0000000..f64c5b1 --- /dev/null +++ b/client/src/app/material.ts @@ -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 { } diff --git a/client/src/app/my-dash/my-dash.component.html b/client/src/app/my-dash/my-dash.component.html new file mode 100644 index 0000000..df9e4bf --- /dev/null +++ b/client/src/app/my-dash/my-dash.component.html @@ -0,0 +1,24 @@ +
+

Dashboard

+ + + + + + {{card.title}} + + + + + + + + +
Card Content Here
+
+
+
+
+
diff --git a/client/src/app/my-dash/my-dash.component.scss b/client/src/app/my-dash/my-dash.component.scss new file mode 100644 index 0000000..49a8146 --- /dev/null +++ b/client/src/app/my-dash/my-dash.component.scss @@ -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; +} diff --git a/client/src/app/my-dash/my-dash.component.spec.ts b/client/src/app/my-dash/my-dash.component.spec.ts new file mode 100644 index 0000000..887c413 --- /dev/null +++ b/client/src/app/my-dash/my-dash.component.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/client/src/app/my-dash/my-dash.component.ts b/client/src/app/my-dash/my-dash.component.ts new file mode 100644 index 0000000..e5ee590 --- /dev/null +++ b/client/src/app/my-dash/my-dash.component.ts @@ -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) {} +} diff --git a/client/src/app/my-nav/my-nav.component.html b/client/src/app/my-nav/my-nav.component.html new file mode 100644 index 0000000..343a948 --- /dev/null +++ b/client/src/app/my-nav/my-nav.component.html @@ -0,0 +1,29 @@ + + + Menu + + Link 1 + Link 2 + Link 3 + + + + + + client + + + + + + diff --git a/client/src/app/my-nav/my-nav.component.scss b/client/src/app/my-nav/my-nav.component.scss new file mode 100644 index 0000000..52465ac --- /dev/null +++ b/client/src/app/my-nav/my-nav.component.scss @@ -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; +} diff --git a/client/src/app/my-nav/my-nav.component.spec.ts b/client/src/app/my-nav/my-nav.component.spec.ts new file mode 100644 index 0000000..18a3e0a --- /dev/null +++ b/client/src/app/my-nav/my-nav.component.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/client/src/app/my-nav/my-nav.component.ts b/client/src/app/my-nav/my-nav.component.ts new file mode 100644 index 0000000..dfabd5c --- /dev/null +++ b/client/src/app/my-nav/my-nav.component.ts @@ -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 = this.breakpointObserver.observe(Breakpoints.Handset) + .pipe( + map(result => result.matches) + ); + + constructor(private breakpointObserver: BreakpointObserver) {} + +} diff --git a/client/src/index.html b/client/src/index.html index 87d768a..09fb832 100644 --- a/client/src/index.html +++ b/client/src/index.html @@ -7,6 +7,8 @@ + + diff --git a/client/src/main.ts b/client/src/main.ts index c7b673c..3b2b7d0 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -1,3 +1,4 @@ +import 'hammerjs'; import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; diff --git a/client/src/styles.scss b/client/src/styles.scss index 90d4ee0..4753ba6 100644 --- a/client/src/styles.scss +++ b/client/src/styles.scss @@ -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; } diff --git a/package.json b/package.json index 9cb055d..0a3aeb4 100644 --- a/package.json +++ b/package.json @@ -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",