Skip to content

Commit

Permalink
feat(panel): make it possible to create a igo-panel without a header
Browse files Browse the repository at this point in the history
  • Loading branch information
cbourget authored and mbarbeau committed Nov 30, 2018
1 parent ebdc466 commit dc9783e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
2 changes: 1 addition & 1 deletion projects/common/src/lib/panel/panel.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="igo-panel-header" title="">
<div *ngIf="withHeader" class="igo-panel-header" title="">
<h3>
<ng-content select="[panelLeftButton]"></ng-content>
<div class="igo-panel-title">
Expand Down
13 changes: 12 additions & 1 deletion projects/common/src/lib/panel/panel.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 17 additions & 1 deletion projects/common/src/lib/panel/panel.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import {
Component,
Input,
ChangeDetectionStrategy,
HostBinding
} from '@angular/core';

@Component({
selector: 'igo-panel',
Expand All @@ -7,6 +12,7 @@ import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class PanelComponent {

@Input()
get title() {
return this._title;
Expand All @@ -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() {}
}
24 changes: 12 additions & 12 deletions projects/common/src/lib/panel/panel.module.ts
Original file line number Diff line number Diff line change
@@ -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 {}

0 comments on commit dc9783e

Please sign in to comment.