Skip to content

Commit

Permalink
feat(package): new - mat-jumbotron supports now templates via `mat-…
Browse files Browse the repository at this point in the history
…jumbotron-content`
  • Loading branch information
AnthonyNahas committed Jun 19, 2018
1 parent 1a187fd commit 9f34870
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 89 deletions.
22 changes: 0 additions & 22 deletions src/module/component/mat-jumbotron.component.html

This file was deleted.

58 changes: 0 additions & 58 deletions src/module/component/mat-jumbotron.component.ts

This file was deleted.

15 changes: 15 additions & 0 deletions src/module/component/mat-jumbotron/mat-jumbotron.component.html
@@ -0,0 +1,15 @@
<mat-card fxLayout="row" fxLayoutAlign="center center">

<mat-card-content fxLayout="row"
fxLayout.xs="column"
fxLayoutGap="2rem"
fxLayoutAlign="center center">
<!--main image-->
<img mat-card-xl-image src="assets/logo.svg">

<div fxLayout="column" fxFlex="50">
<ng-container [ngTemplateOutlet]="jumbotronContent.content"></ng-container>
</div>
</mat-card-content>

</mat-card>
62 changes: 62 additions & 0 deletions src/module/component/mat-jumbotron/mat-jumbotron.component.ts
@@ -0,0 +1,62 @@
import {Component, ContentChild, Input, ViewEncapsulation} from '@angular/core';
import {ObservableMedia} from '@angular/flex-layout';
import {map, startWith} from 'rxjs/operators';
import {Observable} from 'rxjs/internal/Observable';
import {MatJumbotronContentComponent} from './content/mat-jumbotron-content.component';

@Component({
selector: 'mat-jumbotron',
templateUrl: './mat-jumbotron.component.html',
styleUrls: ['./mat-jumbotron.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class MatJumbotronComponent {

@ContentChild(MatJumbotronContentComponent)
jumbotronContent: MatJumbotronContentComponent;

@Input()
title: string;

@Input()
description2: string;

@Input()
image: string;

@Input()
isFluid = true;

displayIdentifier: Observable<number>;

description = 'Angular UI open source library built with material design in order ' +
'to illustrate a highlighted/important information for the user';

constructor() {
}

// private initJumbotronObsMedia() {
// const matrix = new Map([
// ['xs', 1],
// ['sm', 1],
// ['md', 2],
// ['lg', 3],
// ['xl', 3]
// ]);
// let start = 0;
// matrix.forEach((cols, mqAlias) => {
// if (this.observableMedia.isActive(mqAlias)) {
// start = cols;
// console.log('start = ', start, ' cols = ', cols);
// }
// });
// this.displayIdentifier = this.observableMedia
// .asObservable()
// .pipe(
// map(change => {
// console.log(change);
// return matrix.get(change.mqAlias);
// })
// , startWith(start));
// }
}
18 changes: 9 additions & 9 deletions src/module/mat-jumbotron.module.ts
@@ -1,29 +1,29 @@
import { CommonModule } from '@angular/common';
import { NgModule, ModuleWithProviders } from '@angular/core';
import {CommonModule} from '@angular/common';
import {NgModule, ModuleWithProviders} from '@angular/core';

import { MatJumbotronComponent } from './component/mat-jumbotron.component';
import { LibService } from './service/lib.service';
import {MatCardModule} from '@angular/material';
import {FlexLayoutModule} from '@angular/flex-layout';
import {MatJumbotronComponent} from './component/mat-jumbotron/mat-jumbotron.component';
import {MatJumbotronContentComponent} from './component/mat-jumbotron/content/mat-jumbotron-content.component';

// Export module's public API
export { MatJumbotronComponent } from './component/mat-jumbotron.component';
export { LibService } from './service/lib.service';
export {MatJumbotronComponent} from './component/mat-jumbotron/mat-jumbotron.component';
export {MatJumbotronContentComponent} from './component/mat-jumbotron/content/mat-jumbotron-content.component';

@NgModule({
imports: [
CommonModule,
FlexLayoutModule,
MatCardModule,
],
exports: [MatJumbotronComponent],
declarations: [MatJumbotronComponent]
exports: [MatJumbotronComponent, MatJumbotronContentComponent],
declarations: [MatJumbotronComponent, MatJumbotronContentComponent]
})
export class MatJumbotronModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MatJumbotronModule,
providers: [LibService]
providers: []
};
}
}

0 comments on commit 9f34870

Please sign in to comment.