create style.ts to set elevation for all dashboard components

This commit is contained in:
Jesse Lucas 2020-03-16 13:53:07 -04:00
parent eaffbc0f92
commit aebcc495f9
11 changed files with 37 additions and 20 deletions

View File

@ -1 +1,7 @@
<p>device-chart works!</p> <mat-card class="{{elevation}}">
<mat-card-title>Devices</mat-card-title>
<mat-card-content>
<app-donut-chart [elementID]=" chartID">
</app-donut-chart>
</mat-card-content>
</mat-card>

View File

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { cardElevation } from '../../style';
@Component({ @Component({
selector: 'app-device-chart', selector: 'app-device-chart',
@ -6,6 +7,8 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./device-chart.component.scss'] styleUrls: ['./device-chart.component.scss']
}) })
export class DeviceChartComponent implements OnInit { export class DeviceChartComponent implements OnInit {
chartID: string = 'devicesChart';
elevation: string = cardElevation;
constructor() { } constructor() { }

View File

@ -1 +1,6 @@
<p>folder-chart works!</p> <mat-card class="{{elevation}}">
<mat-card-title>Folders</mat-card-title>
<mat-card-content>
<app-donut-chart [elementID]="chartID"></app-donut-chart>
</mat-card-content>
</mat-card>

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { SystemConfigService } from 'src/app/system-config.service';
import { cardElevation } from '../../style'
@Component({ @Component({
selector: 'app-folder-chart', selector: 'app-folder-chart',
@ -6,10 +8,17 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./folder-chart.component.scss'] styleUrls: ['./folder-chart.component.scss']
}) })
export class FolderChartComponent implements OnInit { export class FolderChartComponent implements OnInit {
chartID: string = 'foldersChart';
elevation: string = cardElevation;
constructor() { } constructor(private systemConfigService: SystemConfigService) { }
ngOnInit(): void { ngOnInit(): void {
this.systemConfigService.getFolders().subscribe(
data => {
console.log("char folder data", data)
}
);
} }
} }

View File

@ -4,20 +4,10 @@
<h1>Tech UI</h1> <h1>Tech UI</h1>
</div> </div>
<div gdArea="folders"> <div gdArea="folders">
<mat-card> <app-folder-chart></app-folder-chart>
<mat-card-title>Folders</mat-card-title>
<mat-card-content>
<app-donut-chart [elementID]="foldersChart"></app-donut-chart>
</mat-card-content>
</mat-card>
</div> </div>
<div gdArea="devices"> <div gdArea="devices">
<mat-card> <app-device-chart></app-device-chart>
<mat-card-title>Devices</mat-card-title>
<mat-card-content>
<app-donut-chart [elementID]="devicesChart"></app-donut-chart>
</mat-card-content>
</mat-card>
</div> </div>
<app-status-list gdArea="status-list"></app-status-list> <app-status-list gdArea="status-list"></app-status-list>
<div gdArea="footer"> <div gdArea="footer">

View File

@ -7,8 +7,7 @@ import { SystemConfigService } from '../system-config.service';
styleUrls: ['./dashboard.component.scss'] styleUrls: ['./dashboard.component.scss']
}) })
export class DashboardComponent { export class DashboardComponent {
foldersChart = 'foldersChart';
devicesChart = 'devicesChart';
constructor(private systemConfigService: SystemConfigService) { } constructor(private systemConfigService: SystemConfigService) { }

View File

@ -1,4 +1,4 @@
<div class="mat-elevation-z8"> <div class="{{elevation}}">
<table mat-table class="full-width-table" matSort aria-label="Elements"> <table mat-table class="full-width-table" matSort aria-label="Elements">
<!-- Id Column --> <!-- Id Column -->
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">

View File

@ -6,6 +6,7 @@ import { MatTable } from '@angular/material/table';
import { DeviceListDataSource } from './device-list-datasource'; import { DeviceListDataSource } from './device-list-datasource';
import { Device } from '../../device'; import { Device } from '../../device';
import { SystemConfigService } from '../../system-config.service'; import { SystemConfigService } from '../../system-config.service';
import { cardElevation } from '../../style';
@Component({ @Component({
@ -18,6 +19,7 @@ export class DeviceListComponent implements AfterViewInit, OnInit {
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
@ViewChild(MatTable) table: MatTable<Device>; @ViewChild(MatTable) table: MatTable<Device>;
dataSource: DeviceListDataSource; dataSource: DeviceListDataSource;
elevation: string = cardElevation;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['id', 'name']; displayedColumns = ['id', 'name'];

View File

@ -1,4 +1,4 @@
<div class="mat-elevation-z8"> <div class="{{elevation}}">
<table mat-table class="full-width-table" matSort aria-label="Elements"> <table mat-table class="full-width-table" matSort aria-label="Elements">
<!-- Id Column --> <!-- Id Column -->
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">

View File

@ -6,7 +6,7 @@ import { MatTable } from '@angular/material/table';
import { FolderListDataSource } from './folder-list-datasource'; import { FolderListDataSource } from './folder-list-datasource';
import { Folder } from '../../folder'; import { Folder } from '../../folder';
import { SystemConfigService } from '../../system-config.service'; import { SystemConfigService } from '../../system-config.service';
import { cardElevation } from '../../style';
@Component({ @Component({
selector: 'app-folder-list', selector: 'app-folder-list',
@ -18,6 +18,7 @@ export class FolderListComponent implements AfterViewInit, OnInit {
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
@ViewChild(MatTable) table: MatTable<Folder>; @ViewChild(MatTable) table: MatTable<Folder>;
dataSource: FolderListDataSource; dataSource: FolderListDataSource;
elevation: string = cardElevation;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['id', 'label']; displayedColumns = ['id', 'label'];

2
src/app/style.ts Normal file
View File

@ -0,0 +1,2 @@
// material design elevation for all dashboard components
export const cardElevation: string = "mat-elevation-z2";