-
Notifications
You must be signed in to change notification settings - Fork 5
Added navbar and footer #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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} | ||
| ] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| @NgModule({ | ||
| declarations: [ | ||
| AppComponent | ||
| AppComponent, | ||
| MyNavComponent, | ||
| ], | ||
| imports: [ | ||
| BrowserModule, | ||
| AppRoutingModule | ||
| AppRoutingModule, | ||
| BrowserAnimationsModule, | ||
| LayoutModule, | ||
| MatToolbarModule, | ||
| MatButtonModule, | ||
| MatSidenavModule, | ||
| MatIconModule, | ||
| MatListModule, | ||
| // RouterModule.forRoot(appRoutes), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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] | ||
|
|
||
| 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 { } |
| 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> |
| 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; | ||
| } |
| 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(); | ||
| }); | ||
| }); |
| 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) {} | ||
| } |
| 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> |
| 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; | ||
| } |
| 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(); | ||
| }); | ||
| }); |
| 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) {} | ||
|
|
||
| } |
| 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; } |
There was a problem hiding this comment.
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.