Add material themes to themes carousel

This commit is contained in:
eugene-sinitsyn 2020-03-12 11:08:17 +03:00
parent 8f5eaec1e4
commit 9aa4b9c53f
6 changed files with 50 additions and 26 deletions

View file

@ -7,25 +7,45 @@
[swiper]="swiperConfig" [swiper]="swiperConfig"
[(index)]="sliderIndex"> [(index)]="sliderIndex">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<a href="https://hubs.ly/" target="_blank" class="image-container swiper-slide">
<img *ngIf="breakpoint.width <= breakpoints.sm"
data-src="assets/img/material-light-theme.png"
class="swiper-lazy"
alt="Material Light Theme" />
<img *ngIf="!(breakpoint.width <= breakpoints.sm)"
lazyLoad="assets/img/material-light-theme.png"
defaultImage="assets/img/default.png"
alt="Material Light Theme" />
</a>
<a href="https://hubs.ly/" target="_blank" class="image-container swiper-slide">
<img *ngIf="breakpoint.width <= breakpoints.sm"
data-src="assets/img/material-dark-theme.png"
class="swiper-lazy"
alt="Material Dark Theme" />
<img *ngIf="!(breakpoint.width <= breakpoints.sm)"
lazyLoad="assets/img/material-dark-theme.png"
alt="Material Dark Theme"
defaultImage="assets/img/default.png" />
</a>
<a href="https://hubs.ly/H0n54_z0" target="_blank" class="image-container swiper-slide"> <a href="https://hubs.ly/H0n54_z0" target="_blank" class="image-container swiper-slide">
<img *ngIf="breakpoint.width <= breakpoints.sm" <img *ngIf="breakpoint.width <= breakpoints.sm"
data-src="assets/img/light-theme.png" data-src="assets/img/light-theme.png"
class="swiper-lazy" class="swiper-lazy"
alt="Light Theme" /> alt="Eva Light Theme" />
<img *ngIf="!(breakpoint.width <= breakpoints.sm)" <img *ngIf="!(breakpoint.width <= breakpoints.sm)"
lazyLoad="assets/img/light-theme.png" lazyLoad="assets/img/light-theme.png"
defaultImage="assets/img/default.png" defaultImage="assets/img/default.png"
alt="Light Theme" /> alt="Eva Light Theme" />
</a> </a>
<a href="https://hubs.ly/H0n54SN0" target="_blank" class="image-container swiper-slide"> <a href="https://hubs.ly/H0n54SN0" target="_blank" class="image-container swiper-slide">
<img *ngIf="breakpoint.width <= breakpoints.sm" <img *ngIf="breakpoint.width <= breakpoints.sm"
data-src="assets/img/dark-theme.png" data-src="assets/img/dark-theme.png"
class="swiper-lazy" class="swiper-lazy"
alt="Dark Theme" /> alt="Eva Dark Theme" />
<img *ngIf="!(breakpoint.width <= breakpoints.sm)" <img *ngIf="!(breakpoint.width <= breakpoints.sm)"
lazyLoad="assets/img/dark-theme.png" src="assets/img/dark-theme.png"
defaultImage="assets/img/default.png" alt="Eva Dark Theme"
alt="Dark Theme" /> class="ng-lazyloaded" />
</a> </a>
<a href="https://hubs.ly/H0n55cG0" target="_blank" class="image-container swiper-slide"> <a href="https://hubs.ly/H0n55cG0" target="_blank" class="image-container swiper-slide">
<img *ngIf="breakpoint.width <= breakpoints.sm" <img *ngIf="breakpoint.width <= breakpoints.sm"
@ -33,9 +53,9 @@
class="swiper-lazy" class="swiper-lazy"
alt="Cosmic Theme" /> alt="Cosmic Theme" />
<img *ngIf="!(breakpoint.width <= breakpoints.sm)" <img *ngIf="!(breakpoint.width <= breakpoints.sm)"
lazyLoad="assets/img/cosmic-theme.png" src="assets/img/cosmic-theme.png"
defaultImage="assets/img/default.png" alt="Cosmic Theme"
alt="Cosmic Theme" /> class="ng-lazyloaded"/>
</a> </a>
<a href="https://hubs.ly/H0n55170" target="_blank" class="image-container swiper-slide"> <a href="https://hubs.ly/H0n55170" target="_blank" class="image-container swiper-slide">
<img *ngIf="breakpoint.width <= breakpoints.sm" <img *ngIf="breakpoint.width <= breakpoints.sm"

View file

@ -93,7 +93,7 @@
span { span {
display: inline-block; display: inline-block;
padding: 0.75rem 3.5rem; padding: 0.75rem 1.5rem;
width: 100%; width: 100%;
} }
@ -205,6 +205,7 @@
span { span {
padding: 0.75rem 0; padding: 0.75rem 0;
white-space: pre;
} }
&.swiper-pagination-bullet-active { &.swiper-pagination-bullet-active {

View file

@ -22,8 +22,10 @@ export class ThemeSectionComponent implements OnDestroy {
private alive = true; private alive = true;
private themes: string[] = [ private themes: string[] = [
'Light', 'Material\nLight',
'Dark', 'Material\nDark',
'Eva\nLight',
'Eva\nDark',
'Cosmic', 'Cosmic',
'Corporate', 'Corporate',
]; ];
@ -32,6 +34,7 @@ export class ThemeSectionComponent implements OnDestroy {
breakpoints: any; breakpoints: any;
sliderIndex: number = 1; sliderIndex: number = 1;
initialSwiperConfig: SwiperConfigInterface = { initialSwiperConfig: SwiperConfigInterface = {
initialSlide: 1,
direction: 'horizontal', direction: 'horizontal',
spaceBetween: 200, spaceBetween: 200,
slidesPerView: 'auto', slidesPerView: 'auto',
@ -55,9 +58,7 @@ export class ThemeSectionComponent implements OnDestroy {
renderBullet: (index, className) => { renderBullet: (index, className) => {
return ` return `
<span class="${className}"> <span class="${className}">
<span> <span>${this.themes[index]}</span>
${this.themes[index]}
</span>
</span>`; </span>`;
}, },
}, },
@ -66,8 +67,10 @@ export class ThemeSectionComponent implements OnDestroy {
...this.initialSwiperConfig, ...this.initialSwiperConfig,
}; };
constructor(private themeService: NbThemeService, constructor(
private breakpointService: NbMediaBreakpointsService) { private themeService: NbThemeService,
private breakpointService: NbMediaBreakpointsService,
) {
this.breakpoints = this.breakpointService.getBreakpointsMap(); this.breakpoints = this.breakpointService.getBreakpointsMap();
this.themeService.onMediaQueryChange() this.themeService.onMediaQueryChange()
.pipe(takeWhile(() => this.alive)) .pipe(takeWhile(() => this.alive))

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 KiB

6
package-lock.json generated
View file

@ -1697,9 +1697,9 @@
"integrity": "sha512-+lTkqGB/E1+QAI4Cj6X4hwm4UUUXQDEDubhDl0J0DTN/StyTOpsixrWVNhaGgvQv7UDU4FpJf1l4Bi9yyLq4qg==" "integrity": "sha512-+lTkqGB/E1+QAI4Cj6X4hwm4UUUXQDEDubhDl0J0DTN/StyTOpsixrWVNhaGgvQv7UDU4FpJf1l4Bi9yyLq4qg=="
}, },
"@nebular/bootstrap": { "@nebular/bootstrap": {
"version": "4.3.1", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@nebular/bootstrap/-/bootstrap-4.3.1.tgz", "resolved": "https://registry.npmjs.org/@nebular/bootstrap/-/bootstrap-4.4.0.tgz",
"integrity": "sha512-slFWRKhNJd1pQPhxyufYNcR+yKDCOSxAQyG9U586t+Tt3IELIX4ThYptP2NU88KNcapVbt+1JUy227SRoEnCcQ==" "integrity": "sha512-9O+O/yphPdXv2Hni7YYXsEY2FPgyLmj9n5lEPeQtRWutzb1kHaNtAkvSzyBJ429Kr9LOvOvOtsc8OKcoxYbEmA=="
}, },
"@nebular/eva-icons": { "@nebular/eva-icons": {
"version": "4.4.0", "version": "4.4.0",