From dc9783e1577107288fa67dd17fee06fab3f797bb Mon Sep 17 00:00:00 2001 From: cbourget Date: Fri, 23 Nov 2018 10:28:44 -0500 Subject: [PATCH] feat(panel): make it possible to create a igo-panel without a header --- .../common/src/lib/panel/panel.component.html | 2 +- .../common/src/lib/panel/panel.component.scss | 13 +++++++++- .../common/src/lib/panel/panel.component.ts | 18 +++++++++++++- projects/common/src/lib/panel/panel.module.ts | 24 +++++++++---------- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/projects/common/src/lib/panel/panel.component.html b/projects/common/src/lib/panel/panel.component.html index 887661ade2..fc50c4740c 100644 --- a/projects/common/src/lib/panel/panel.component.html +++ b/projects/common/src/lib/panel/panel.component.html @@ -1,4 +1,4 @@ -
+

diff --git a/projects/common/src/lib/panel/panel.component.scss b/projects/common/src/lib/panel/panel.component.scss index b069746515..3604a83954 100644 --- a/projects/common/src/lib/panel/panel.component.scss +++ b/projects/common/src/lib/panel/panel.component.scss @@ -26,10 +26,21 @@ } .igo-panel-content { - height: calc(100% - #{$igo-panel-header-height}); overflow: auto; } +:host.igo-panel-with-header { + .igo-panel-content { + height: calc(100% - #{$igo-panel-header-height}); + } +} + +:host:not(.igo-panel-with-header) { + .igo-panel-content { + height: 100%; + } +} + .igo-panel-title { display: block; width: calc(100% - 80px); diff --git a/projects/common/src/lib/panel/panel.component.ts b/projects/common/src/lib/panel/panel.component.ts index 179a9adc22..956850e67b 100644 --- a/projects/common/src/lib/panel/panel.component.ts +++ b/projects/common/src/lib/panel/panel.component.ts @@ -1,4 +1,9 @@ -import { Component, Input, ChangeDetectionStrategy } from '@angular/core'; +import { + Component, + Input, + ChangeDetectionStrategy, + HostBinding +} from '@angular/core'; @Component({ selector: 'igo-panel', @@ -7,6 +12,7 @@ import { Component, Input, ChangeDetectionStrategy } from '@angular/core'; changeDetection: ChangeDetectionStrategy.OnPush }) export class PanelComponent { + @Input() get title() { return this._title; @@ -16,5 +22,15 @@ export class PanelComponent { } private _title: string; + @Input() + @HostBinding('class.igo-panel-with-header') + get withHeader(): boolean { + return this._withHeader; + } + set withHeader(value: boolean) { + this._withHeader = value; + } + private _withHeader = true; + constructor() {} } diff --git a/projects/common/src/lib/panel/panel.module.ts b/projects/common/src/lib/panel/panel.module.ts index bc8fbac70c..f1ce32fde9 100644 --- a/projects/common/src/lib/panel/panel.module.ts +++ b/projects/common/src/lib/panel/panel.module.ts @@ -1,16 +1,16 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; import { PanelComponent } from './panel.component'; @NgModule({ - imports: [], - declarations: [PanelComponent], - exports: [PanelComponent] + imports: [ + CommonModule + ], + exports: [ + PanelComponent + ], + declarations: [ + PanelComponent + ] }) -export class IgoPanelModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: IgoPanelModule, - providers: [] - }; - } -} +export class IgoPanelModule {}