From cf3de8cf35dace6c849f1a073e0f27be80784084 Mon Sep 17 00:00:00 2001 From: Jesse Lucas Date: Wed, 11 Mar 2020 21:22:43 -0400 Subject: [PATCH] toggle status lists --- .../status-list/status-list.component.html | 6 ++--- src/app/status-list/status-list.component.ts | 8 +++++++ .../status-toggle.component.html | 6 ++--- .../status-toggle/status-toggle.component.ts | 24 +++++++++---------- src/app/status.ts | 4 ++++ 5 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 src/app/status.ts diff --git a/src/app/status-list/status-list.component.html b/src/app/status-list/status-list.component.html index 81824da5e..698342b0b 100644 --- a/src/app/status-list/status-list.component.html +++ b/src/app/status-list/status-list.component.html @@ -1,3 +1,3 @@ - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/app/status-list/status-list.component.ts b/src/app/status-list/status-list.component.ts index b07491865..6fc011497 100644 --- a/src/app/status-list/status-list.component.ts +++ b/src/app/status-list/status-list.component.ts @@ -1,4 +1,6 @@ import { Component, OnInit } from '@angular/core'; +import { Status } from '../status'; + @Component({ selector: 'app-status-list', @@ -6,10 +8,16 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./status-list.component.scss'] }) export class StatusListComponent implements OnInit { + public currentStatus: Status = Status.Folders; + public status = Status; constructor() { } ngOnInit(): void { } + onToggle(s: Status) { + console.log("holy moly", s); + this.currentStatus = s; + } } diff --git a/src/app/status-toggle/status-toggle.component.html b/src/app/status-toggle/status-toggle.component.html index 289bccadb..58b10e4fc 100644 --- a/src/app/status-toggle/status-toggle.component.html +++ b/src/app/status-toggle/status-toggle.component.html @@ -1,4 +1,4 @@ - - Folders - Devices + + Folders + Devices \ No newline at end of file diff --git a/src/app/status-toggle/status-toggle.component.ts b/src/app/status-toggle/status-toggle.component.ts index 781359c55..6557ad626 100644 --- a/src/app/status-toggle/status-toggle.component.ts +++ b/src/app/status-toggle/status-toggle.component.ts @@ -1,9 +1,7 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { Status } from '../status'; + -export enum ToggleAction { - Folders = 1, - Devices, -} @Component({ selector: 'app-status-toggle', @@ -12,20 +10,20 @@ export enum ToggleAction { }) export class StatusToggleComponent implements OnInit { - public toggleAction = ToggleAction - constructor() { } + public status = Status + @Output() statusEvent = new EventEmitter(); + constructor() { } ngOnInit(): void { } - onSelect(label: ToggleAction): void { - - console.log("here?"); - switch (label) { - case ToggleAction.Folders: + onSelect(s: Status): void { + this.statusEvent.emit(s); + switch (s) { + case Status.Folders: console.log("folder action"); break; - case ToggleAction.Devices: + case Status.Devices: console.log("Device action"); break; } diff --git a/src/app/status.ts b/src/app/status.ts new file mode 100644 index 000000000..872798394 --- /dev/null +++ b/src/app/status.ts @@ -0,0 +1,4 @@ +export enum Status { + Folders = 1, + Devices, +} \ No newline at end of file