Skip to content

Commit 9f34870

Browse files
committed
feat(package): new - mat-jumbotron supports now templates via mat-jumbotron-content
1 parent 1a187fd commit 9f34870

7 files changed

+86
-89
lines changed

src/module/component/mat-jumbotron.component.html

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/module/component/mat-jumbotron.component.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<mat-card fxLayout="row" fxLayoutAlign="center center">
2+
3+
<mat-card-content fxLayout="row"
4+
fxLayout.xs="column"
5+
fxLayoutGap="2rem"
6+
fxLayoutAlign="center center">
7+
<!--main image-->
8+
<img mat-card-xl-image src="assets/logo.svg">
9+
10+
<div fxLayout="column" fxFlex="50">
11+
<ng-container [ngTemplateOutlet]="jumbotronContent.content"></ng-container>
12+
</div>
13+
</mat-card-content>
14+
15+
</mat-card>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import {Component, ContentChild, Input, ViewEncapsulation} from '@angular/core';
2+
import {ObservableMedia} from '@angular/flex-layout';
3+
import {map, startWith} from 'rxjs/operators';
4+
import {Observable} from 'rxjs/internal/Observable';
5+
import {MatJumbotronContentComponent} from './content/mat-jumbotron-content.component';
6+
7+
@Component({
8+
selector: 'mat-jumbotron',
9+
templateUrl: './mat-jumbotron.component.html',
10+
styleUrls: ['./mat-jumbotron.component.scss'],
11+
encapsulation: ViewEncapsulation.None
12+
})
13+
export class MatJumbotronComponent {
14+
15+
@ContentChild(MatJumbotronContentComponent)
16+
jumbotronContent: MatJumbotronContentComponent;
17+
18+
@Input()
19+
title: string;
20+
21+
@Input()
22+
description2: string;
23+
24+
@Input()
25+
image: string;
26+
27+
@Input()
28+
isFluid = true;
29+
30+
displayIdentifier: Observable<number>;
31+
32+
description = 'Angular UI open source library built with material design in order ' +
33+
'to illustrate a highlighted/important information for the user';
34+
35+
constructor() {
36+
}
37+
38+
// private initJumbotronObsMedia() {
39+
// const matrix = new Map([
40+
// ['xs', 1],
41+
// ['sm', 1],
42+
// ['md', 2],
43+
// ['lg', 3],
44+
// ['xl', 3]
45+
// ]);
46+
// let start = 0;
47+
// matrix.forEach((cols, mqAlias) => {
48+
// if (this.observableMedia.isActive(mqAlias)) {
49+
// start = cols;
50+
// console.log('start = ', start, ' cols = ', cols);
51+
// }
52+
// });
53+
// this.displayIdentifier = this.observableMedia
54+
// .asObservable()
55+
// .pipe(
56+
// map(change => {
57+
// console.log(change);
58+
// return matrix.get(change.mqAlias);
59+
// })
60+
// , startWith(start));
61+
// }
62+
}

src/module/mat-jumbotron.module.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import { CommonModule } from '@angular/common';
2-
import { NgModule, ModuleWithProviders } from '@angular/core';
1+
import {CommonModule} from '@angular/common';
2+
import {NgModule, ModuleWithProviders} from '@angular/core';
33

4-
import { MatJumbotronComponent } from './component/mat-jumbotron.component';
5-
import { LibService } from './service/lib.service';
64
import {MatCardModule} from '@angular/material';
75
import {FlexLayoutModule} from '@angular/flex-layout';
6+
import {MatJumbotronComponent} from './component/mat-jumbotron/mat-jumbotron.component';
7+
import {MatJumbotronContentComponent} from './component/mat-jumbotron/content/mat-jumbotron-content.component';
88

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

1313
@NgModule({
1414
imports: [
1515
CommonModule,
1616
FlexLayoutModule,
1717
MatCardModule,
1818
],
19-
exports: [MatJumbotronComponent],
20-
declarations: [MatJumbotronComponent]
19+
exports: [MatJumbotronComponent, MatJumbotronContentComponent],
20+
declarations: [MatJumbotronComponent, MatJumbotronContentComponent]
2121
})
2222
export class MatJumbotronModule {
2323
static forRoot(): ModuleWithProviders {
2424
return {
2525
ngModule: MatJumbotronModule,
26-
providers: [LibService]
26+
providers: []
2727
};
2828
}
2929
}

0 commit comments

Comments
 (0)