feat(theme): add corporate theme (#1727)

This commit is contained in:
Denis Strigo 2018-06-21 15:16:53 +03:00 committed by Dmitry Nehaychik
parent 6d705d2786
commit e37f12dfc9
45 changed files with 3747 additions and 2960 deletions

View file

@ -11,6 +11,7 @@
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
"options": { "options": {
"preserveSymlinks": true,
"outputPath": "dist", "outputPath": "dist",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",

5638
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,11 @@
"bugs": { "bugs": {
"url": "https://github.com/akveo/ngx-admin/issues" "url": "https://github.com/akveo/ngx-admin/issues"
}, },
"browserslist": [
"> 1%",
"last 2 versions",
"IE 11"
],
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"conventional-changelog": "conventional-changelog", "conventional-changelog": "conventional-changelog",

View file

@ -6,21 +6,22 @@
<div class="logo" (click)="goToHome()">ngx-<span>admin</span></div> <div class="logo" (click)="goToHome()">ngx-<span>admin</span></div>
</div> </div>
<ngx-theme-switcher></ngx-theme-switcher> <ngx-theme-switcher></ngx-theme-switcher>
<ngx-layout-direction-switcher></ngx-layout-direction-switcher>
</div> </div>
<nb-actions <div class="header-container">
size="medium" <ngx-layout-direction-switcher></ngx-layout-direction-switcher>
class="header-container" <nb-actions
[class.right]="position === 'normal'" size="medium"
[class.left]="position === 'inverse'"> [class.right]="position === 'normal'"
<nb-action icon="nb-gear" class="toggle-layout" (click)="toggleSettings()"></nb-action> [class.left]="position === 'inverse'">
<nb-action *nbIsGranted="['view', 'user']" > <nb-action icon="nb-gear" class="toggle-layout" (click)="toggleSettings()"></nb-action>
<nb-user [nbContextMenu]="userMenu" [name]="user?.name" [picture]="user?.picture"></nb-user> <nb-action *nbIsGranted="['view', 'user']" >
</nb-action> <nb-user [nbContextMenu]="userMenu" [name]="user?.name" [picture]="user?.picture"></nb-user>
<nb-action class="control-item" disabled icon="nb-notifications"></nb-action> </nb-action>
<nb-action class="control-item" icon="nb-email"></nb-action> <nb-action class="control-item" disabled icon="nb-notifications"></nb-action>
<nb-action class="control-item"> <nb-action class="control-item" icon="nb-email"></nb-action>
<nb-search type="rotate-layout" (click)="startSearch()"></nb-search> <nb-action class="control-item">
</nb-action> <nb-search type="rotate-layout" (click)="startSearch()"></nb-search>
</nb-actions> </nb-action>
</nb-actions>
</div>

View file

@ -21,6 +21,7 @@
.logo-containter { .logo-containter {
display: flex; display: flex;
align-items: center; align-items: center;
width: calc(#{nb-theme(sidebar-width)} - #{nb-theme(header-padding)});
} }
.control-item { .control-item {
@ -30,7 +31,7 @@
.header-container { .header-container {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%; width: auto;
.navigation { .navigation {
@include nb-ltr(padding-right, nb-theme(padding)); @include nb-ltr(padding-right, nb-theme(padding));
@ -58,9 +59,33 @@
} }
} }
ngx-layout-direction-switcher, @include nb-for-theme(corporate) {
$menu-action-separator-color: #3f4550;
nb-action {
@include nb-ltr(border-left-color, $menu-action-separator-color);
@include nb-rtl(border-right-color, $menu-action-separator-color);
}
.header-container .logo {
@include nb-ltr(border, none);
@include nb-rtl(border, none);
}
.header-container /deep/ ngx-theme-switcher .dropdown-toggle {
color: nb-theme(color-white);
background: transparent;
}
}
ngx-layout-direction-switcher {
margin: 0 1.5rem;
}
ngx-theme-switcher { ngx-theme-switcher {
margin: 0 1em; margin: nb-theme(layout-padding);
margin-top: 0;
margin-bottom: 0;
} }
@include media-breakpoint-down(xl) { @include media-breakpoint-down(xl) {
@ -142,10 +167,13 @@
padding: 0; padding: 0;
} }
ngx-layout-direction-switcher, ngx-layout-direction-switcher {
ngx-theme-switcher {
display: none; display: none;
} }
ngx-theme-switcher {
margin: 0 0.5rem;
}
} }
@include media-breakpoint-down(sm) { @include media-breakpoint-down(sm) {
@ -167,6 +195,10 @@
display: none; display: none;
} }
ngx-theme-switcher {
display: none;
}
nb-action:not(.toggle-layout) { nb-action:not(.toggle-layout) {
padding: 0; padding: 0;
} }

View file

@ -6,3 +6,4 @@ export * from './theme-settings/theme-settings.component';
export * from './theme-switcher/theme-switcher.component'; export * from './theme-switcher/theme-switcher.component';
export * from './switcher/switcher.component'; export * from './switcher/switcher.component';
export * from './layout-direction-switcher/layout-direction-switcher.component' export * from './layout-direction-switcher/layout-direction-switcher.component'
export * from './theme-switcher/themes-switcher-list/themes-switcher-list.component'

View file

@ -62,16 +62,16 @@
.switch { .switch {
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 4rem; width: 3rem;
height: 1.75rem; height: 1.5rem;
margin: 0; margin: 0;
input { input {
display: none; display: none;
&:checked + .slider::before { &:checked + .slider::before {
@include nb-ltr(transform, translateX(2.25rem)); @include nb-ltr(transform, translateX(1.5rem));
@include nb-rtl(transform, translateX(-2.25rem)); @include nb-rtl(transform, translateX(-1.5rem));
} }
} }
@ -88,8 +88,8 @@
.slider::before { .slider::before {
position: absolute; position: absolute;
content: ''; content: '';
height: 1.75rem; height: 1.5rem;
width: 1.75rem; width: 1.5rem;
border-radius: 50%; border-radius: 50%;
background-color: nb-theme(color-success); background-color: nb-theme(color-success);
transition: 0.2s; transition: 0.2s;
@ -99,6 +99,10 @@
@include nb-for-theme(cosmic) { @include nb-for-theme(cosmic) {
@include btn-hero-primary-gradient(); @include btn-hero-primary-gradient();
} }
@include nb-for-theme(corporate) {
background-color: nb-theme(color-primary);
}
} }
} }

View file

@ -26,10 +26,6 @@ import { StateService } from '../../../@core/data/state.service';
<i [attr.class]="sidebar.icon"></i> <i [attr.class]="sidebar.icon"></i>
</a> </a>
</div> </div>
<h6 class="settings">SETTINGS</h6>
<div class="switcher">
<ngx-theme-switcher [vertical]="true"></ngx-theme-switcher>
</div>
<div class="switcher"> <div class="switcher">
<ngx-layout-direction-switcher [vertical]="true"></ngx-layout-direction-switcher> <ngx-layout-direction-switcher [vertical]="true"></ngx-layout-direction-switcher>
</div> </div>

View file

@ -0,0 +1,7 @@
<div class="themes-switcher"
[nbPopover]="switcherListComponent"
nbPopoverPlacement="bottom"
[nbPopoverContext]="{popover: popover}">
<i class="nb-drops"></i>
<span *ngIf="showTitle">Themes</span>
</div>

View file

@ -0,0 +1,49 @@
@import '../../styles/themes';
@import '~@nebular/theme/styles/core/mixins';
@import '~@nebular/theme/styles/core/functions';
@include nb-install-component() {
.themes-switcher {
display: flex;
font-size: 1.25rem;
padding: 0.8rem 1.25rem;
align-items: center;
cursor: pointer;
background-color: nb-theme(switcher-background);
border-radius: nb-theme(radius);
&:hover {
$color: nb-theme(switcher-background);
background-color: tint($color, 14%);
}
span {
margin: 0 1.2rem;
}
i {
color: nb-theme(color-primary);
font-size: 1.8rem;
border-radius: 50%;
position: relative;
@include nb-for-theme(default) {
color: nb-theme(color-success);
}
@include nb-for-theme(corporate) {
color: nb-theme(color-fg-highlight);
}
&::before {
// Hack for IE11, IE11 should not set background
background: nb-theme(drops-icon-line-gadient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
}
}

View file

@ -1,57 +1,19 @@
import { Component, OnInit, Input } from '@angular/core'; import { Component, Input, ViewChild } from '@angular/core';
import { NbThemeService } from '@nebular/theme'; import { NbPopoverDirective } from '@nebular/theme';
import { NbJSThemeOptions } from '@nebular/theme/services/js-themes/theme.options'; import { NbJSThemeOptions } from '@nebular/theme/services/js-themes/theme.options';
import { AnalyticsService } from '../../../@core/utils/analytics.service';
import { ThemeSwitcherListComponent } from './themes-switcher-list/themes-switcher-list.component';
@Component({ @Component({
selector: 'ngx-theme-switcher', selector: 'ngx-theme-switcher',
template: ` templateUrl: './theme-switcher.component.html',
<ngx-switcher styleUrls: ['./theme-switcher.component.scss'],
[firstValue]="false"
[secondValue]="true"
[firstValueLabel]="'Light'"
[secondValueLabel]="'Cosmic'"
[value]="currentBoolTheme()"
(valueChange)="toggleTheme($event)"
[vertical]="vertical"
>
</ngx-switcher>
`,
}) })
export class ThemeSwitcherComponent implements OnInit { export class ThemeSwitcherComponent {
@ViewChild(NbPopoverDirective) popover: NbPopoverDirective;
@Input() showTitle: boolean = true;
switcherListComponent = ThemeSwitcherListComponent;
theme: NbJSThemeOptions; theme: NbJSThemeOptions;
firstTheme = 'default';
secondTheme = 'cosmic';
@Input() vertical: boolean = false;
constructor(
private themeService: NbThemeService,
private analyticsService: AnalyticsService,
) {}
ngOnInit() {
this.themeService.getJsTheme()
.subscribe((theme: NbJSThemeOptions) => this.theme = theme);
}
toggleTheme(theme: boolean) {
const themeName = this.boolToTheme(theme);
this.themeService.changeTheme(themeName);
this.analyticsService.trackEvent('switchTheme');
}
currentBoolTheme() {
return this.themeToBool(this.theme);
}
private themeToBool(theme: NbJSThemeOptions) {
return theme.name === this.secondTheme;
}
private boolToTheme(theme: boolean) {
return theme ? this.secondTheme : this.firstTheme;
}
} }

View file

@ -0,0 +1,76 @@
@import '../../../styles/themes';
@import '~@nebular/theme/styles/core/mixins';
@import '~bootstrap/scss/mixins/breakpoints';
@import '~@nebular/theme/styles/global/bootstrap/breakpoints';
$icon-color-default: #0bbb79;
$icon-color-cosmic: #7958fa;
$icon-color-corporate: #a7a2be;
$icon-top-color-default: #01dbb5;
$icon-top-color-cosmic: #a258fe;
$icon-top-color-corporate: #e9e8eb;
@include nb-install-component() {
/deep/ .themes-switcher-list {
padding: 1rem 2rem 1.25rem 0.5rem;
margin: 0;
@include nb-ltr(text-align, start);
@include nb-rtl(text-align, end);
.themes-switcher-item {
list-style: none;
cursor: pointer;
&:hover span {
opacity: 0.5;
}
i {
font-size: 2rem;
&.drop-icon-default {
color: $icon-color-default;
// Hack for IE11, IE11 should not set background
background: -webkit-linear-gradient($icon-top-color-default, $icon-color-default);
}
&.drop-icon-cosmic {
color: $icon-color-cosmic;
// Hack for IE11, IE11 should not set background
background: -webkit-linear-gradient($icon-top-color-cosmic, $icon-color-cosmic);
}
&.drop-icon-corporate {
color: $icon-color-corporate;
// Hack for IE11, IE11 should not set background
background: -webkit-linear-gradient($icon-top-color-corporate, $icon-color-corporate);
}
&.drop-icon-default,
&.drop-icon-cosmic,
&.drop-icon-corporate {
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
span {
font-weight: 300;
vertical-align: super;
padding-left: 1rem;
color: nb-theme(color-fg-heading);
}
}
}
@include media-breakpoint-down(is) {
/deep/ .themes-switcher-list {
display: none;
}
}
}

View file

@ -0,0 +1,51 @@
import {Component, Input} from '@angular/core';
import { NbThemeService, NbPopoverDirective } from '@nebular/theme';
import { AnalyticsService } from '../../../../@core/utils/analytics.service';
import { NbJSThemeOptions } from '@nebular/theme/services/js-themes/theme.options';
@Component({
selector: 'ngx-theme-switcher-list',
template: `
<ul class="themes-switcher-list">
<li class="themes-switcher-item"
*ngFor="let theme of themes"
(click)="onToggleTheme(theme.key)">
<i class="nb-drop" [ngClass]="'drop-icon-' + theme.key"></i>
<span>{{ theme.title }}</span>
</li>
</ul>
`,
styleUrls: ['./theme-switcher-list.component.scss'],
})
export class ThemeSwitcherListComponent {
@Input() popover: NbPopoverDirective;
theme: NbJSThemeOptions;
themes = [
{
title: 'Light',
key: 'default',
},
{
title: 'Cosmic',
key: 'cosmic',
},
{
title: 'Corporate',
key: 'corporate',
},
];
constructor(
private themeService: NbThemeService,
private analyticsService: AnalyticsService,
) {}
onToggleTheme(themeKey: string) {
this.themeService.changeTheme(themeKey);
this.analyticsService.trackEvent('switchTheme');
this.popover.hide();
}
}

View file

@ -47,11 +47,31 @@
margin-top: nb-theme(sidebar-header-gap); margin-top: nb-theme(sidebar-header-gap);
@include nb-for-theme(corporate) {
margin-top: 0;
}
/deep/ .main-container { /deep/ .main-container {
height: height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important; calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important;
@include nb-ltr(border-top-right-radius, nb-theme(radius)); @include nb-ltr(border-top-right-radius, nb-theme(radius));
@include nb-rtl(border-top-left-radius, nb-theme(radius)); @include nb-rtl(border-top-left-radius, nb-theme(radius));
@include nb-for-theme(corporate) {
border: 1px solid nb-theme(separator);
height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)}) !important;
}
}
/deep/ .scrollable {
@include nb-for-theme(corporate) {
padding-top: 0;
.menu-item:first-child {
border-top: none;
}
}
} }
/deep/ nb-sidebar-header { /deep/ nb-sidebar-header {
@ -67,6 +87,10 @@
font-weight: bold; font-weight: bold;
transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48); transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48);
@include nb-for-theme(corporate) {
border-radius: nb-theme(radius);
}
i { i {
font-size: 2rem; font-size: 2rem;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);

View file

@ -1,4 +1,6 @@
import { Component } from '@angular/core'; import { Component, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators/takeWhile';
// TODO: move layouts into the framework // TODO: move layouts into the framework
@Component({ @Component({
@ -11,7 +13,7 @@ import { Component } from '@angular/core';
</nb-layout-header> </nb-layout-header>
<nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive> <nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive>
<nb-sidebar-header> <nb-sidebar-header *ngIf="currentTheme !== 'corporate'">
<a href="#" class="btn btn-hero-success main-btn"> <a href="#" class="btn btn-hero-success main-btn">
<i class="ion ion-social-github"></i> <span>Support Us</span> <i class="ion ion-social-github"></i> <span>Support Us</span>
</a> </a>
@ -29,5 +31,21 @@ import { Component } from '@angular/core';
</nb-layout> </nb-layout>
`, `,
}) })
export class OneColumnLayoutComponent { export class OneColumnLayoutComponent implements OnDestroy {
private alive = true;
currentTheme: string;
constructor(protected themeService: NbThemeService) {
this.themeService.getJsTheme()
.pipe(takeWhile(() => this.alive))
.subscribe(theme => {
this.currentTheme = theme.name;
});
}
ngOnDestroy() {
this.alive = false;
}
} }

View file

@ -47,11 +47,31 @@
margin-top: nb-theme(sidebar-header-gap); margin-top: nb-theme(sidebar-header-gap);
@include nb-for-theme(corporate) {
margin-top: 0;
}
/deep/ .main-container { /deep/ .main-container {
height: height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important; calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important;
@include nb-ltr(border-top-right-radius, nb-theme(radius)); @include nb-ltr(border-top-right-radius, nb-theme(radius));
@include nb-rtl(border-top-left-radius, nb-theme(radius)); @include nb-rtl(border-top-left-radius, nb-theme(radius));
@include nb-for-theme(corporate) {
border: 1px solid nb-theme(separator);
height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)}) !important;
}
}
/deep/ .scrollable {
@include nb-for-theme(corporate) {
padding-top: 0;
.menu-item:first-child {
border-top: none;
}
}
} }
/deep/ nb-sidebar-header { /deep/ nb-sidebar-header {
@ -67,6 +87,10 @@
font-weight: bold; font-weight: bold;
transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48); transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48);
@include nb-for-theme(corporate) {
border-radius: nb-theme(radius);
}
i { i {
font-size: 2rem; font-size: 2rem;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);

View file

@ -1,6 +1,5 @@
import { Component, OnDestroy } from '@angular/core'; import { Component, OnDestroy } from '@angular/core';
import { delay, withLatestFrom } from 'rxjs/operators'; import { delay, withLatestFrom, takeWhile } from 'rxjs/operators';
import { Subscription } from 'rxjs';
import { import {
NbMediaBreakpoint, NbMediaBreakpoint,
NbMediaBreakpointsService, NbMediaBreakpointsService,
@ -26,7 +25,7 @@ import { StateService } from '../../../@core/data/state.service';
tag="menu-sidebar" tag="menu-sidebar"
responsive responsive
[end]="sidebar.id === 'end'"> [end]="sidebar.id === 'end'">
<nb-sidebar-header> <nb-sidebar-header *ngIf="currentTheme !== 'corporate'">
<a href="#" class="btn btn-hero-success main-btn"> <a href="#" class="btn btn-hero-success main-btn">
<i class="ion ion-social-github"></i> <span>Support Us</span> <i class="ion ion-social-github"></i> <span>Support Us</span>
</a> </a>
@ -106,26 +105,29 @@ export class SampleLayoutComponent implements OnDestroy {
layout: any = {}; layout: any = {};
sidebar: any = {}; sidebar: any = {};
protected layoutState$: Subscription; private alive = true;
protected sidebarState$: Subscription;
protected menuClick$: Subscription; currentTheme: string;
constructor(protected stateService: StateService, constructor(protected stateService: StateService,
protected menuService: NbMenuService, protected menuService: NbMenuService,
protected themeService: NbThemeService, protected themeService: NbThemeService,
protected bpService: NbMediaBreakpointsService, protected bpService: NbMediaBreakpointsService,
protected sidebarService: NbSidebarService) { protected sidebarService: NbSidebarService) {
this.layoutState$ = this.stateService.onLayoutState() this.stateService.onLayoutState()
.pipe(takeWhile(() => this.alive))
.subscribe((layout: string) => this.layout = layout); .subscribe((layout: string) => this.layout = layout);
this.sidebarState$ = this.stateService.onSidebarState() this.stateService.onSidebarState()
.pipe(takeWhile(() => this.alive))
.subscribe((sidebar: string) => { .subscribe((sidebar: string) => {
this.sidebar = sidebar; this.sidebar = sidebar;
}); });
const isBp = this.bpService.getByName('is'); const isBp = this.bpService.getByName('is');
this.menuClick$ = this.menuService.onItemSelect() this.menuService.onItemSelect()
.pipe( .pipe(
takeWhile(() => this.alive),
withLatestFrom(this.themeService.onMediaQueryChange()), withLatestFrom(this.themeService.onMediaQueryChange()),
delay(20), delay(20),
) )
@ -135,11 +137,15 @@ export class SampleLayoutComponent implements OnDestroy {
this.sidebarService.collapse('menu-sidebar'); this.sidebarService.collapse('menu-sidebar');
} }
}); });
this.themeService.getJsTheme()
.pipe(takeWhile(() => this.alive))
.subscribe(theme => {
this.currentTheme = theme.name;
});
} }
ngOnDestroy() { ngOnDestroy() {
this.layoutState$.unsubscribe(); this.alive = false;
this.sidebarState$.unsubscribe();
this.menuClick$.unsubscribe();
} }
} }

View file

@ -47,11 +47,31 @@
margin-top: nb-theme(sidebar-header-gap); margin-top: nb-theme(sidebar-header-gap);
@include nb-for-theme(corporate) {
margin-top: 0;
}
/deep/ .main-container { /deep/ .main-container {
height: height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important; calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important;
@include nb-ltr(border-top-right-radius, nb-theme(radius)); @include nb-ltr(border-top-right-radius, nb-theme(radius));
@include nb-rtl(border-top-left-radius, nb-theme(radius)); @include nb-rtl(border-top-left-radius, nb-theme(radius));
@include nb-for-theme(corporate) {
border: 1px solid nb-theme(separator);
height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)}) !important;
}
}
/deep/ .scrollable {
@include nb-for-theme(corporate) {
padding-top: 0;
.menu-item:first-child {
border-top: none;
}
}
} }
/deep/ nb-sidebar-header { /deep/ nb-sidebar-header {
@ -67,6 +87,10 @@
font-weight: bold; font-weight: bold;
transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48); transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48);
@include nb-for-theme(corporate) {
border-radius: nb-theme(radius);
}
i { i {
font-size: 2rem; font-size: 2rem;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);

View file

@ -1,4 +1,6 @@
import { Component } from '@angular/core'; import { Component, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators/takeWhile';
// TODO: move layouts into the framework // TODO: move layouts into the framework
@Component({ @Component({
@ -11,7 +13,7 @@ import { Component } from '@angular/core';
</nb-layout-header> </nb-layout-header>
<nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive > <nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive >
<nb-sidebar-header> <nb-sidebar-header *ngIf="currentTheme !== 'corporate'">
<a href="#" class="btn btn-hero-success main-btn"> <a href="#" class="btn btn-hero-success main-btn">
<i class="ion ion-social-github"></i> <span>Support Us</span> <i class="ion ion-social-github"></i> <span>Support Us</span>
</a> </a>
@ -35,5 +37,21 @@ import { Component } from '@angular/core';
</nb-layout> </nb-layout>
`, `,
}) })
export class ThreeColumnsLayoutComponent { export class ThreeColumnsLayoutComponent implements OnDestroy {
private alive = true;
currentTheme: string;
constructor(protected themeService: NbThemeService) {
this.themeService.getJsTheme()
.pipe(takeWhile(() => this.alive))
.subscribe(theme => {
this.currentTheme = theme.name;
});
}
ngOnDestroy() {
this.alive = false;
}
} }

View file

@ -47,11 +47,32 @@
margin-top: nb-theme(sidebar-header-gap); margin-top: nb-theme(sidebar-header-gap);
@include nb-for-theme(corporate) {
margin-top: 0;
}
/deep/ .main-container { /deep/ .main-container {
height: height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important; calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)} - #{nb-theme(sidebar-header-gap)}) !important;
@include nb-ltr(border-top-right-radius, nb-theme(radius)); @include nb-ltr(border-top-right-radius, nb-theme(radius));
@include nb-rtl(border-top-left-radius, nb-theme(radius)); @include nb-rtl(border-top-left-radius, nb-theme(radius));
@include nb-for-theme(corporate) {
border: 1px solid nb-theme(separator);
height:
calc(#{nb-theme(sidebar-height)} - #{nb-theme(header-height)}) !important;
}
}
/deep/ .scrollable {
@include nb-for-theme(corporate) {
padding-top: 0;
.menu-item:first-child {
border-top: none;
}
}
} }
/deep/ nb-sidebar-header { /deep/ nb-sidebar-header {
@ -67,6 +88,10 @@
font-weight: bold; font-weight: bold;
transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48); transition: padding 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.48);
@include nb-for-theme(corporate) {
border-radius: nb-theme(radius);
}
i { i {
font-size: 2rem; font-size: 2rem;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);

View file

@ -1,4 +1,6 @@
import { Component } from '@angular/core'; import { Component, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators/takeWhile';
// TODO: move layouts into the framework // TODO: move layouts into the framework
@Component({ @Component({
@ -11,7 +13,7 @@ import { Component } from '@angular/core';
</nb-layout-header> </nb-layout-header>
<nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive > <nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive >
<nb-sidebar-header> <nb-sidebar-header *ngIf="currentTheme !== 'corporate'">
<a href="#" class="btn btn-hero-success main-btn"> <a href="#" class="btn btn-hero-success main-btn">
<i class="ion ion-social-github"></i> <span>Support Us</span> <i class="ion ion-social-github"></i> <span>Support Us</span>
</a> </a>
@ -33,5 +35,21 @@ import { Component } from '@angular/core';
</nb-layout> </nb-layout>
`, `,
}) })
export class TwoColumnsLayoutComponent { export class TwoColumnsLayoutComponent implements OnDestroy {
private alive = true;
currentTheme: string;
constructor(protected themeService: NbThemeService) {
this.themeService.getJsTheme()
.pipe(takeWhile(() => this.alive))
.subscribe(theme => {
this.currentTheme = theme.name;
});
}
ngOnDestroy() {
this.alive = false;
}
} }

View file

@ -0,0 +1,86 @@
export const CORPORATE_THEME = {
name: 'corporate',
base: 'default',
variables: {
temperature: [
'#ffa36b',
'#ffa36b',
'#ff9e7a',
'#ff9888',
'#ff8ea0',
],
solar: {
gradientLeft: '#ff8ea0',
gradientRight: '#ffa36b',
shadowColor: 'rgba(0, 0, 0, 0)',
radius: ['80%', '90%'],
},
traffic: {
colorBlack: '#000000',
tooltipBg: '#eef2f5',
tooltipBorderColor: '#eef2f5',
tooltipExtraCss: 'border-radius: 10px; padding: 4px 16px;',
tooltipTextColor: '#2a2a2a',
tooltipFontWeight: '400',
lineBg: '#c0c8d1',
lineShadowBlur: '0',
itemColor: '#bcc3cc',
itemBorderColor: '#bcc3cc',
itemEmphasisBorderColor: '#74a2ff',
shadowLineDarkBg: 'rgba(0, 0, 0, 0)',
shadowLineShadow: 'rgba(0, 0, 0, 0)',
gradFrom: '#ffffff',
gradTo: '#ffffff',
},
electricity: {
tooltipBg: '#edf0f4',
tooltipLineColor: '#bdc4cd',
tooltipLineWidth: '0',
tooltipBorderColor: '#ebeef2',
tooltipExtraCss: 'border-radius: 10px; padding: 8px 24px;',
tooltipTextColor: '#2a2a2a',
tooltipFontWeight: 'bolder',
axisLineColor: 'rgba(0, 0, 0, 0)',
xAxisTextColor: '#2a2a2a',
yAxisSplitLine: '#ebeef2',
itemBorderColor: '#73a1ff',
lineStyle: 'solid',
lineWidth: '4',
lineGradFrom: '#bdc4cd',
lineGradTo: '#c0c8d1',
lineShadow: 'rgba(0, 0, 0, 0)',
areaGradFrom: 'rgba(255, 255, 255, 0)',
areaGradTo: 'rgba(255, 255, 255, 0)',
shadowLineDarkBg: 'rgba(255, 255, 255, 0)',
},
bubbleMap: {
titleColor: '#484848',
areaColor: '#dddddd',
areaHoverColor: '#cccccc',
areaBorderColor: '#ebeef2',
},
echarts: {
bg: '#ffffff',
textColor: '#484848',
axisLineColor: '#bbbbbb',
splitLineColor: '#ebeef2',
itemHoverShadowColor: 'rgba(0, 0, 0, 0.5)',
tooltipBackgroundColor: '#6a7985',
areaOpacity: '0.7',
},
chartjs: {
axisLineColor: '#cccccc',
textColor: '#484848',
},
},
};

View file

@ -4,7 +4,7 @@
@import '~@nebular/theme/styles/themes'; @import '~@nebular/theme/styles/themes';
// which themes you what to enable (empty to enable all) // which themes you what to enable (empty to enable all)
$nb-enabled-themes: (default, cosmic); $nb-enabled-themes: (default, cosmic, corporate);
$nb-themes: nb-register-theme(( $nb-themes: nb-register-theme((
// app wise variables for each theme // app wise variables for each theme
@ -14,6 +14,9 @@ $nb-themes: nb-register-theme((
font-main: Roboto, font-main: Roboto,
font-secondary: Exo, font-secondary: Exo,
switcher-background: #ebeff5,
drops-icon-line-gadient: -webkit-linear-gradient(#01dbb5, #0bbb79),
), default, default); ), default, default);
$nb-themes: nb-register-theme(( $nb-themes: nb-register-theme((
@ -24,4 +27,20 @@ $nb-themes: nb-register-theme((
font-main: Roboto, font-main: Roboto,
font-secondary: Exo, font-secondary: Exo,
switcher-background: #4e41a5,
drops-icon-line-gadient: -webkit-linear-gradient(#a258fe, #7958fa),
), cosmic, cosmic); ), cosmic, cosmic);
$nb-themes: nb-register-theme((
// app wise variables for each theme
sidebar-header-gap: 2rem,
sidebar-header-height: initial,
layout-content-width: 1400px,
font-main: Roboto,
font-secondary: Exo,
switcher-background: #2b2d34,
drops-icon-line-gadient: -webkit-linear-gradient(#e9e8eb, #a7a2be),
), corporate, corporate);

View file

@ -30,6 +30,7 @@ import {
LayoutDirectionSwitcherComponent, LayoutDirectionSwitcherComponent,
ThemeSwitcherComponent, ThemeSwitcherComponent,
TinyMCEComponent, TinyMCEComponent,
ThemeSwitcherListComponent,
} from './components'; } from './components';
import { CapitalizePipe, PluralPipe, RoundPipe, TimingPipe } from './pipes'; import { CapitalizePipe, PluralPipe, RoundPipe, TimingPipe } from './pipes';
import { import {
@ -40,6 +41,7 @@ import {
} from './layouts'; } from './layouts';
import { DEFAULT_THEME } from './styles/theme.default'; import { DEFAULT_THEME } from './styles/theme.default';
import { COSMIC_THEME } from './styles/theme.cosmic'; import { COSMIC_THEME } from './styles/theme.cosmic';
import { CORPORATE_THEME } from './styles/theme.corporate';
const BASE_MODULES = [CommonModule, FormsModule, ReactiveFormsModule]; const BASE_MODULES = [CommonModule, FormsModule, ReactiveFormsModule];
@ -64,6 +66,7 @@ const COMPONENTS = [
SwitcherComponent, SwitcherComponent,
LayoutDirectionSwitcherComponent, LayoutDirectionSwitcherComponent,
ThemeSwitcherComponent, ThemeSwitcherComponent,
ThemeSwitcherListComponent,
HeaderComponent, HeaderComponent,
FooterComponent, FooterComponent,
SearchInputComponent, SearchInputComponent,
@ -75,6 +78,10 @@ const COMPONENTS = [
TwoColumnsLayoutComponent, TwoColumnsLayoutComponent,
]; ];
const ENTRY_COMPONENTS = [
ThemeSwitcherListComponent,
];
const PIPES = [ const PIPES = [
CapitalizePipe, CapitalizePipe,
PluralPipe, PluralPipe,
@ -87,7 +94,7 @@ const NB_THEME_PROVIDERS = [
{ {
name: 'cosmic', name: 'cosmic',
}, },
[ DEFAULT_THEME, COSMIC_THEME ], [ DEFAULT_THEME, COSMIC_THEME, CORPORATE_THEME ],
).providers, ).providers,
...NbSidebarModule.forRoot().providers, ...NbSidebarModule.forRoot().providers,
...NbMenuModule.forRoot().providers, ...NbMenuModule.forRoot().providers,
@ -97,6 +104,7 @@ const NB_THEME_PROVIDERS = [
imports: [...BASE_MODULES, ...NB_MODULES], imports: [...BASE_MODULES, ...NB_MODULES],
exports: [...BASE_MODULES, ...NB_MODULES, ...COMPONENTS, ...PIPES], exports: [...BASE_MODULES, ...NB_MODULES, ...COMPONENTS, ...PIPES],
declarations: [...COMPONENTS, ...PIPES], declarations: [...COMPONENTS, ...PIPES],
entryComponents: [...ENTRY_COMPONENTS],
}) })
export class ThemeModule { export class ThemeModule {
static forRoot(): ModuleWithProviders { static forRoot(): ModuleWithProviders {

View file

@ -23,6 +23,10 @@
&:not(:last-child) { &:not(:last-child) {
border-bottom: 1px solid nb-theme(separator); border-bottom: 1px solid nb-theme(separator);
@include nb-for-theme(corporate) {
border-bottom-color: nb-theme(tabs-separator);
}
} }
} }

View file

@ -1,25 +1,8 @@
<div class="row"> <div class="row">
<div class="col-xxxl-3 col-md-6"> <div class="col-xxxl-3 col-md-6" *ngFor="let statusCard of statusCards">
<ngx-status-card title="Light" type="primary"> <ngx-status-card [title]="statusCard.title"
<i class="nb-lightbulb"></i> [type]="statusCard.type">
</ngx-status-card> <i [ngClass]="statusCard.iconClass"></i>
</div>
<div class="col-xxxl-3 col-md-6">
<ngx-status-card title="Roller Shades" type="success">
<i class="nb-roller-shades"></i>
</ngx-status-card>
</div>
<div class="col-xxxl-3 col-md-6">
<ngx-status-card title="Wireless Audio" type="info">
<i class="nb-audio"></i>
</ngx-status-card>
</div>
<div class="col-xxxl-3 col-md-6">
<ngx-status-card title="Coffee Maker" type="warning">
<i class="nb-coffee-maker"></i>
</ngx-status-card> </ngx-status-card>
</div> </div>
</div> </div>

View file

@ -1,9 +1,88 @@
import { Component } from '@angular/core'; import {Component, OnDestroy} from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators/takeWhile' ;
interface ICardSettings {
title: string;
iconClass: string;
type: string;
}
@Component({ @Component({
selector: 'ngx-dashboard', selector: 'ngx-dashboard',
styleUrls: ['./dashboard.component.scss'], styleUrls: ['./dashboard.component.scss'],
templateUrl: './dashboard.component.html', templateUrl: './dashboard.component.html',
}) })
export class DashboardComponent { export class DashboardComponent implements OnDestroy {
private alive = true;
lightCard: ICardSettings = {
title: 'Light',
iconClass: 'nb-lightbulb',
type: 'primary',
};
rollerShadesCard: ICardSettings = {
title: 'Roller Shades',
iconClass: 'nb-roller-shades',
type: 'success',
};
wirelessAudioCard: ICardSettings = {
title: 'Wireless Audio',
iconClass: 'nb-audio',
type: 'info',
};
coffeeMakerCard: ICardSettings = {
title: 'Coffee Maker',
iconClass: 'nb-coffee-maker',
type: 'warning',
};
statusCards: string;
commonStatusCardsSet: ICardSettings[] = [
this.lightCard,
this.rollerShadesCard,
this.wirelessAudioCard,
this.coffeeMakerCard,
];
statusCardsByThemes: {
default: ICardSettings[];
cosmic: ICardSettings[];
corporate: ICardSettings[];
} = {
default: this.commonStatusCardsSet,
cosmic: this.commonStatusCardsSet,
corporate: [
{
...this.lightCard,
type: 'warning',
},
{
...this.rollerShadesCard,
type: 'primary',
},
{
...this.wirelessAudioCard,
type: 'danger',
},
{
...this.coffeeMakerCard,
type: 'secondary',
},
],
};
constructor(private themeService: NbThemeService) {
this.themeService.getJsTheme()
.pipe(takeWhile(() => this.alive))
.subscribe(theme => {
this.statusCards = this.statusCardsByThemes[theme.name];
});
}
ngOnDestroy() {
this.alive = false;
}
} }

View file

@ -31,7 +31,7 @@
</div> </div>
</div> </div>
<div class="stats-block"> <div class="stats-block currency">
<div class="subtitle">Spent</div> <div class="subtitle">Spent</div>
<div> <div>
<span class="value">291</span> <span class="value">291</span>
@ -40,7 +40,9 @@
</div> </div>
</div> </div>
<div class="dropdown" ngbDropdown> <div class="dropdown"
[ngClass]="{ 'ghost-dropdown': currentTheme === 'corporate' }"
ngbDropdown>
<button type="button" ngbDropdownToggle class="btn" <button type="button" ngbDropdownToggle class="btn"
[ngClass]="{ 'btn-outline-success': currentTheme == 'default', 'btn-primary': currentTheme != 'default'}"> [ngClass]="{ 'btn-outline-success': currentTheme == 'default', 'btn-primary': currentTheme != 'default'}">
{{ type }} {{ type }}

View file

@ -3,6 +3,7 @@
@import '~@nebular/theme/styles/global/typography/typography'; @import '~@nebular/theme/styles/global/typography/typography';
@import '~bootstrap/scss/mixins/breakpoints'; @import '~bootstrap/scss/mixins/breakpoints';
@import '~@nebular/theme/styles/global/bootstrap/breakpoints'; @import '~@nebular/theme/styles/global/bootstrap/breakpoints';
@import '~@nebular/theme/styles/global/bootstrap/hero-buttons';
@include nb-install-component() { @include nb-install-component() {
@ -22,6 +23,10 @@
height: 100%; height: 100%;
z-index: 2; z-index: 2;
box-shadow: nb-theme(card-shadow); box-shadow: nb-theme(card-shadow);
@include nb-for-theme(corporate) {
border-right: 1px solid nb-theme(card-border-color);
}
} }
.table-header { .table-header {
@ -88,9 +93,29 @@
justify-content: space-between; justify-content: space-between;
padding: nb-theme(padding); padding: nb-theme(padding);
color: nb-theme(color-fg); color: nb-theme(color-fg);
position: relative;
&:not(:first-child) { &:not(:first-child) {
border-top: 1px solid nb-theme(separator); border-top: 1px solid nb-theme(separator);
@include nb-for-theme(corporate) {
border-top-color: nb-theme(tabs-separator);
}
}
&:hover {
background-color: nb-theme(layout-bg);
&::before {
position: absolute;
content: '';
height: 100%;
width: 6px;
left: 0;
top: 0;
background-color: nb-theme(color-success);
border-radius: nb-theme(radius);
}
} }
.month { .month {
@ -169,7 +194,7 @@
.stats-block { .stats-block {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: normal;
color: nb-theme(color-fg); color: nb-theme(color-fg);
padding: 0 1.5rem; padding: 0 1.5rem;
border-right: 1px solid nb-theme(separator); border-right: 1px solid nb-theme(separator);
@ -210,6 +235,48 @@
.stats-block .value { .stats-block .value {
font-weight: nb-theme(font-weight-bolder); font-weight: nb-theme(font-weight-bolder);
} }
.stats-month {
&:hover {
&::before {
$color-top: nb-theme(btn-success-bg);
$color-bottom: btn-hero-success-left-color();
background-image: linear-gradient(to top, $color-top, $color-bottom);
box-shadow: 0 0 16px -2px btn-hero-success-middle-color();
}
}
}
}
@include nb-for-theme(corporate) {
nb-tabset /deep/ ul li.active {
&::before {
display: none;
}
}
.stats-block {
border-right: none;
}
.stats-month {
&:hover {
&::before {
background-color: nb-theme(color-primary);
}
}
.delta {
&.down {
color: text-primary();
&::before {
border-top: 8px solid text-primary();
}
}
}
}
} }
@include media-breakpoint-down(xxl) { @include media-breakpoint-down(xxl) {

View file

@ -67,6 +67,10 @@
@include nb-for-theme(cosmic) { @include nb-for-theme(cosmic) {
background-color: nb-theme(link-color); background-color: nb-theme(link-color);
} }
@include nb-for-theme(corporate) {
background-color: nb-theme(color-primary);
}
} }
.progress { .progress {
@ -99,6 +103,12 @@
background: nb-theme(link-color); background: nb-theme(link-color);
} }
} }
@include nb-for-theme(corporate) {
@include install-thumb() {
background: nb-theme(color-primary);
}
}
} }
} }

View file

@ -92,4 +92,12 @@
} }
} }
} }
@include nb-for-theme(corporate) {
.selected-room {
.room-border {
stroke: nb-theme(color-primary);
}
}
}
} }

View file

@ -12,6 +12,11 @@
@include nb-for-theme(cosmic) { @include nb-for-theme(cosmic) {
background-image: url('../../../../assets/images/square_pattern_cosmic.svg'); background-image: url('../../../../assets/images/square_pattern_cosmic.svg');
} }
@include nb-for-theme(corporate) {
background: none;
border-right-color: nb-theme(tabs-separator);
}
} }
ngx-player { ngx-player {

View file

@ -115,6 +115,10 @@
color: nb-theme(color-fg); color: nb-theme(color-fg);
font-size: 3rem; font-size: 3rem;
margin-right: 0.5rem; margin-right: 0.5rem;
@include nb-for-theme(corporate) {
color: nb-theme(actions-fg);
}
} }
span { span {
@ -145,6 +149,19 @@
} }
} }
@include nb-for-theme(corporate) {
.cameras-filter a {
&.active {
color: nb-theme(color-primary);
}
&:first-child {
@include nb-ltr(border-left, 1px solid nb-theme(border-color));
@include nb-rtl(border-right, 1px solid nb-theme(border-color));
}
}
}
@include media-breakpoint-down(lg) { @include media-breakpoint-down(lg) {
nb-action { nb-action {
padding: 0; padding: 0;

View file

@ -47,6 +47,26 @@
@include btn-hero-warning-gradient(); @include btn-hero-warning-gradient();
@include btn-hero-warning-bevel-glow-shadow(); @include btn-hero-warning-bevel-glow-shadow();
} }
&.danger {
@include btn-hero-danger-gradient();
@include btn-hero-danger-bevel-glow-shadow();
}
&.secondary {
@include btn-hero-secondary-bg();
@include btn-hero-secondary-bevel-glow-shadow();
color: nb-theme(card-fg);
}
@include nb-for-theme(corporate) {
&.primary,
&.success,
&.info,
&.warning,
&.danger,
&.secondary {
box-shadow: none;
}
}
} }
&:hover { &:hover {
@ -65,6 +85,12 @@
&.warning { &.warning {
background-image: btn-hero-warning-light-gradient(); background-image: btn-hero-warning-light-gradient();
} }
&.danger {
background-image: btn-hero-danger-light-gradient();
}
&.secondary {
background-image: btn-hero-secondary-light-gradient();
}
} }
} }
@ -74,10 +100,14 @@
.icon { .icon {
color: nb-theme(card-fg); color: nb-theme(card-fg);
&.primary, &.success, &.info, &.warning { &.primary, &.success, &.info, &.warning, &.danger {
box-shadow: none; box-shadow: none;
background-image: linear-gradient(to right, transparent, transparent); background-image: linear-gradient(to right, transparent, transparent);
} }
&.secondary {
background: transparent;
}
} }
.title { .title {
@ -143,4 +173,12 @@
} }
} }
} }
@include nb-for-theme(corporate) {
nb-card {
.icon-container {
height: auto;
}
}
}
} }

View file

@ -91,4 +91,14 @@
text-shadow: 0 0 6px rgba(255, 255, 255, 0.5); text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
} }
} }
@include nb-for-theme(corporate) {
.circle {
stroke: nb-theme(color-warning);
}
.power-bg {
color: nb-theme(separator);
}
}
} }

View file

@ -124,6 +124,14 @@
} }
} }
@include nb-for-theme(corporate) {
.btn-icon.active {
color: nb-theme(color-primary);
border: none;
background-color: nb-theme(layout-bg);
}
}
@include media-breakpoint-down(is) { @include media-breakpoint-down(is) {
ngx-temperature-dragger { ngx-temperature-dragger {
max-width: 250px; max-width: 250px;

View file

@ -59,6 +59,10 @@
0 4px 10px rgba(33, 7, 77, 0.5), 0 4px 10px rgba(33, 7, 77, 0.5),
0 2px 10px #928dff; 0 2px 10px #928dff;
} }
@include nb-for-theme(corporate) {
color: nb-theme(color-warning);
}
} }
} }

View file

@ -39,6 +39,10 @@
width: $button-size; width: $button-size;
height: $button-size; height: $button-size;
border-radius: nb-theme(btn-border-radius); border-radius: nb-theme(btn-border-radius);
@include nb-for-theme(corporate) {
border-radius: nb-theme(btn-semi-round-border-radius);
}
} }
.state-details { .state-details {

View file

@ -17,6 +17,13 @@
<span class="subheader">{{ hb[themeName].border }}</span> <span class="subheader">{{ hb[themeName].border }}</span>
</div> </div>
</div> </div>
<div class="state-container" *ngIf="hb[themeName].color">
<div class="state-value color"></div>
<div class="state-details">
<span class="header">Color</span>
<span class="subheader">{{ hb[themeName].color }}</span>
</div>
</div>
<div class="state-container" *ngIf="hb[themeName].gradientLeft"> <div class="state-container" *ngIf="hb[themeName].gradientLeft">
<div class="state-value gradient"></div> <div class="state-value gradient"></div>
<div class="state-details"> <div class="state-details">
@ -51,8 +58,8 @@
<div class="state-value glow" [ngClass]="{ 'none': !hb[themeName].glow }"></div> <div class="state-value glow" [ngClass]="{ 'none': !hb[themeName].glow }"></div>
<div class="state-details" *ngIf="hb[themeName].glow"> <div class="state-details" *ngIf="hb[themeName].glow">
<span class="header">Glow</span> <span class="header">Glow</span>
<span class="subheader">0 2px 12px 0</span> <span class="subheader">{{ hb[themeName].glow.params }}</span>
<span class="subheader">{{ hb[themeName].glow }}</span> <span class="subheader">{{ hb[themeName].glow.color }}</span>
</div> </div>
<div class="state-details" *ngIf="!hb[themeName].glow"> <div class="state-details" *ngIf="!hb[themeName].glow">
<span class="header">No Glow</span> <span class="header">No Glow</span>

View file

@ -39,6 +39,9 @@
} }
.primary-container { .primary-container {
.color {
background-color: nb-theme(color-primary);
}
.gradient { .gradient {
@include btn-hero-primary-gradient(); @include btn-hero-primary-gradient();
} }
@ -51,6 +54,9 @@
} }
.warning-container { .warning-container {
.color {
background-color: nb-theme(color-warning);
}
.gradient { .gradient {
@include btn-hero-warning-gradient(); @include btn-hero-warning-gradient();
} }
@ -63,6 +69,9 @@
} }
.success-container { .success-container {
.color {
background-color: nb-theme(color-success);
}
.gradient { .gradient {
@include btn-hero-success-gradient(); @include btn-hero-success-gradient();
} }
@ -75,6 +84,9 @@
} }
.info-container { .info-container {
.color {
background-color: nb-theme(color-info);
}
.gradient { .gradient {
@include btn-hero-info-gradient(); @include btn-hero-info-gradient();
} }
@ -87,6 +99,9 @@
} }
.danger-container { .danger-container {
.color {
background-color: nb-theme(color-danger);
}
.gradient { .gradient {
@include btn-hero-danger-gradient(); @include btn-hero-danger-gradient();
} }
@ -99,6 +114,9 @@
} }
.secondary-container { .secondary-container {
.color {
background-color: nb-theme(btn-secondary-bg);
}
.border { .border {
color: nb-theme(btn-secondary-color); color: nb-theme(btn-secondary-color);
border: nb-theme(btn-secondary-border-width) solid nb-theme(btn-secondary-border); border: nb-theme(btn-secondary-border-width) solid nb-theme(btn-secondary-border);

View file

@ -1,5 +1,6 @@
import { Component, OnDestroy } from '@angular/core'; import { Component, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme'; import { NbThemeService } from '@nebular/theme';
import { Subscription } from 'rxjs';
@Component({ @Component({
selector: 'ngx-hero-buttons', selector: 'ngx-hero-buttons',
@ -10,7 +11,7 @@ export class HeroButtonComponent implements OnDestroy {
themeName = 'default'; themeName = 'default';
settings: Array<any>; settings: Array<any>;
themeSubscription: any; themeSubscription: Subscription;
constructor(private themeService: NbThemeService) { constructor(private themeService: NbThemeService) {
this.themeSubscription = this.themeService.getJsTheme().subscribe(theme => { this.themeSubscription = this.themeService.getJsTheme().subscribe(theme => {
@ -29,12 +30,22 @@ export class HeroButtonComponent implements OnDestroy {
gradientLeft: `adjust-hue(${colors.primary}, 20deg)`, gradientLeft: `adjust-hue(${colors.primary}, 20deg)`,
gradientRight: colors.primary, gradientRight: colors.primary,
}, },
corporate: {
color: colors.primary,
glow: {
params: '0 0 20px 0',
color: 'rgba (115, 161, 255, 0.5)',
},
},
cosmic: { cosmic: {
gradientLeft: `adjust-hue(${colors.primary}, 20deg)`, gradientLeft: `adjust-hue(${colors.primary}, 20deg)`,
gradientRight: colors.primary, gradientRight: colors.primary,
bevel: `shade(${colors.primary}, 14%)`, bevel: `shade(${colors.primary}, 14%)`,
shadow: 'rgba (6, 7, 64, 0.5)', shadow: 'rgba (6, 7, 64, 0.5)',
glow: `adjust-hue(${colors.primary}, 10deg)`, glow: {
params: '0 2px 12px 0',
color: `adjust-hue(${colors.primary}, 10deg)`,
},
}, },
}, { }, {
class: 'btn-hero-warning', class: 'btn-hero-warning',
@ -45,12 +56,22 @@ export class HeroButtonComponent implements OnDestroy {
gradientLeft: `adjust-hue(${colors.warning}, 10deg)`, gradientLeft: `adjust-hue(${colors.warning}, 10deg)`,
gradientRight: colors.warning, gradientRight: colors.warning,
}, },
corporate: {
color: colors.warning,
glow: {
params: '0 0 20px 0',
color: 'rgba (256, 163, 107, 0.5)',
},
},
cosmic: { cosmic: {
gradientLeft: `adjust-hue(${colors.warning}, 10deg)`, gradientLeft: `adjust-hue(${colors.warning}, 10deg)`,
gradientRight: colors.warning, gradientRight: colors.warning,
bevel: `shade(${colors.warning}, 14%)`, bevel: `shade(${colors.warning}, 14%)`,
shadow: 'rgba (33, 7, 77, 0.5)', shadow: 'rgba (33, 7, 77, 0.5)',
glow: `adjust-hue(${colors.warning}, 5deg)`, glow: {
params: '0 2px 12px 0',
color: `adjust-hue(${colors.warning}, 5deg)`,
},
}, },
}, { }, {
class: 'btn-hero-success', class: 'btn-hero-success',
@ -61,12 +82,22 @@ export class HeroButtonComponent implements OnDestroy {
gradientLeft: `adjust-hue(${colors.success}, 20deg)`, gradientLeft: `adjust-hue(${colors.success}, 20deg)`,
gradientRight: colors.success, gradientRight: colors.success,
}, },
corporate: {
color: colors.success,
glow: {
params: '0 0 20px 0',
color: 'rgba (93, 207, 227, 0.5)',
},
},
cosmic: { cosmic: {
gradientLeft: `adjust-hue(${colors.success}, 20deg)`, gradientLeft: `adjust-hue(${colors.success}, 20deg)`,
gradientRight: colors.success, gradientRight: colors.success,
bevel: `shade(${colors.success}, 14%)`, bevel: `shade(${colors.success}, 14%)`,
shadow: 'rgba (33, 7, 77, 0.5)', shadow: 'rgba (33, 7, 77, 0.5)',
glow: `adjust-hue(${colors.success}, 10deg)`, glow: {
params: '0 2px 12px 0',
color: `adjust-hue(${colors.success}, 10deg)`,
},
}, },
}, { }, {
class: 'btn-hero-info', class: 'btn-hero-info',
@ -77,12 +108,22 @@ export class HeroButtonComponent implements OnDestroy {
gradientLeft: `adjust-hue(${colors.info}, -10deg)`, gradientLeft: `adjust-hue(${colors.info}, -10deg)`,
gradientRight: colors.info, gradientRight: colors.info,
}, },
corporate: {
color: colors.info,
glow: {
params: '0 0 20px 0',
color: 'rgba (186, 127, 236, 0.5)',
},
},
cosmic: { cosmic: {
gradientLeft: `adjust-hue(${colors.info}, -10deg)`, gradientLeft: `adjust-hue(${colors.info}, -10deg)`,
gradientRight: colors.info, gradientRight: colors.info,
bevel: `shade(${colors.info}, 14%)`, bevel: `shade(${colors.info}, 14%)`,
shadow: 'rgba (33, 7, 77, 0.5)', shadow: 'rgba (33, 7, 77, 0.5)',
glow: `adjust-hue(${colors.info}, -5deg)`, glow: {
params: '0 2px 12px 0',
color: `adjust-hue(${colors.info}, -5deg)`,
},
}, },
}, { }, {
class: 'btn-hero-danger', class: 'btn-hero-danger',
@ -93,12 +134,22 @@ export class HeroButtonComponent implements OnDestroy {
gradientLeft: `adjust-hue(${colors.danger}, -20deg)`, gradientLeft: `adjust-hue(${colors.danger}, -20deg)`,
gradientRight: colors.danger, gradientRight: colors.danger,
}, },
corporate: {
color: colors.danger,
glow: {
params: '0 0 20px 0',
color: 'rgba (255, 107, 131, 0.5)',
},
},
cosmic: { cosmic: {
gradientLeft: `adjust-hue(${colors.danger}, -20deg)`, gradientLeft: `adjust-hue(${colors.danger}, -20deg)`,
gradientRight: colors.danger, gradientRight: colors.danger,
bevel: `shade(${colors.danger}, 14%)`, bevel: `shade(${colors.danger}, 14%)`,
shadow: 'rgba (33, 7, 77, 0.5)', shadow: 'rgba (33, 7, 77, 0.5)',
glow: `adjust-hue(${colors.danger}, -10deg)`, glow: {
params: '0 2px 12px 0',
color: `adjust-hue(${colors.danger}, -10deg)`,
},
}, },
}, { }, {
class: 'btn-hero-secondary', class: 'btn-hero-secondary',
@ -108,11 +159,17 @@ export class HeroButtonComponent implements OnDestroy {
default: { default: {
border: '#dadfe6', border: '#dadfe6',
}, },
corporate: {
color: '#edf2f5',
},
cosmic: { cosmic: {
border: colors.primary, border: colors.primary,
bevel: '#665ebd', bevel: '#665ebd',
shadow: 'rgba (33, 7, 77, 0.5)', shadow: 'rgba (33, 7, 77, 0.5)',
glow: 'rgba (146, 141, 255, 1)', glow: {
params: '0 2px 12px 0',
color: 'rgba (146, 141, 255, 1)',
},
}, },
}]; }];
} }

View file

@ -14,6 +14,10 @@
font-size: 2.5rem; font-size: 2.5rem;
@include nb-ltr(margin-right, 1rem); @include nb-ltr(margin-right, 1rem);
@include nb-rtl(margin-left, 1rem); @include nb-rtl(margin-left, 1rem);
@include nb-for-theme(corporate) {
color: nb-theme(actions-fg);
}
} }
span { span {

View file

@ -7,6 +7,7 @@
padding: 0 0 29px; padding: 0 0 29px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between;
} }
.shape-container { .shape-container {

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -16,6 +16,12 @@
}, },
"exclude": [ "exclude": [
"test.ts", "test.ts",
"**/*.spec.ts" "**/*.spec.ts",
"../node_modules/@nebular/**/*.spec.ts"
],
"include": [
"../src/*.ts",
"../src/**/*.ts",
"../node_modules/@nebular/**/*.ts"
] ]
} }