Add main info component with material theme screenshot to material landing page

This commit is contained in:
eugene-sinitsyn 2020-03-12 15:27:41 +03:00 committed by Sergey Andrievskiy
parent f274118c0e
commit a962c248a5
4 changed files with 26 additions and 14 deletions

View file

@ -5,7 +5,7 @@
<img *ngIf="breakpoint.width >= breakpoints.md"
class="main-img"
defaultImage="assets/img/default.png"
lazyLoad="assets/img/ngx-admin.png"/>
[lazyLoad]="imageUrl"/>
</a>
</div>
<div class="main-inf">

View file

@ -4,7 +4,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { Component, OnDestroy } from '@angular/core';
import { Component, OnDestroy, Input, OnInit } from '@angular/core';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { NbMediaBreakpoint, NbMediaBreakpointsService, NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators';
@ -14,24 +15,31 @@ import { takeWhile } from 'rxjs/operators';
styleUrls: ['./main-info-section.component.scss'],
})
export class MainInfoSectionComponent implements OnDestroy {
private alive = true;
breakpoint: NbMediaBreakpoint;
breakpoints: any;
constructor(private themeService: NbThemeService,
private breakpointService: NbMediaBreakpointsService) {
this.breakpoints = this.breakpointService.getBreakpointsMap();
this.themeService.onMediaQueryChange()
constructor(themeService: NbThemeService, breakpointService: NbMediaBreakpointsService) {
this.breakpoints = breakpointService.getBreakpointsMap();
themeService.onMediaQueryChange()
.pipe(takeWhile(() => this.alive))
.subscribe(([oldValue, newValue]) => {
this.breakpoint = newValue;
});
}
ngOnDestroy() {
private alive = true;
public readonly breakpoints: any;
public breakpoint: NbMediaBreakpoint;
public forMaterialTheme: boolean = false;
@Input() public set material(value: any) {
this.forMaterialTheme = coerceBooleanProperty(value);
}
public get imageUrl(): string {
return this.forMaterialTheme
? 'assets/img/ngx-admin-material.png'
: '/assets/img/ngx-admin.png';
}
public ngOnDestroy() {
this.alive = false;
}
}

View file

@ -3,6 +3,10 @@
<ngx-landing-header></ngx-landing-header>
</nb-layout-header>
<nb-layout-column>
<ngx-landing-main-info material></ngx-landing-main-info>
</nb-layout-column>
<nb-layout-footer class="footer" fixed>
<ngx-landing-footer></ngx-landing-footer>
</nb-layout-footer>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB