nebular update and structure refactoring

This commit is contained in:
Dmitry Nehaychik 2019-06-11 18:18:58 +03:00
parent 78e4d2cfe9
commit df489ad17e
100 changed files with 736 additions and 3945 deletions

View file

@ -1,26 +1,29 @@
<div class="header-container"
[class.left]="position === 'normal'"
[class.right]="position === 'inverse'">
<div class="logo-containter">
<a (click)="toggleSidebar()" href="#" class="navigation"><i class="nb-menu"></i></a>
<div class="logo" (click)="goToHome()">ngx-<span>admin</span></div>
<div class="logo-container">
<a (click)="toggleSidebar()" href="#" class="navigation">
<nb-icon icon="menu-2-outline"></nb-icon>
</a>
<a class="logo" href="#" (click)="navigateHome()">ngx-<span>admin</span></a>
</div>
<ngx-theme-switcher></ngx-theme-switcher>
<nb-select [(selected)]="currentTheme" (selectedChange)="toggleTheme()" status="primary">
<nb-option *ngFor="let theme of themes" [value]="theme.value"> {{ theme.name }}</nb-option>
</nb-select>
</div>
<div class="header-container">
<ngx-layout-direction-switcher></ngx-layout-direction-switcher>
<nb-actions
size="medium"
size="small"
[class.right]="position === 'normal'"
[class.left]="position === 'inverse'">
<nb-action *nbIsGranted="['view', 'user']" >
<nb-user [nbContextMenu]="userMenu" [name]="user?.name" [picture]="user?.picture"></nb-user>
</nb-action>
<nb-action class="control-item" disabled icon="nb-notifications"></nb-action>
<nb-action class="control-item" icon="nb-email"></nb-action>
<nb-action class="control-item" icon="bell-outline"></nb-action>
<nb-action class="control-item" icon="email-outline"></nb-action>
<nb-action class="control-item">
<nb-search type="rotate-layout" (click)="startSearch()"></nb-search>
<nb-search type="rotate-layout"></nb-search>
</nb-action>
</nb-actions>
</div>

View file

@ -1,7 +1,7 @@
@import '../../styles/themes';
@import '~bootstrap/scss/mixins/breakpoints';
@import '~@nebular/theme/styles/global/breakpoints';
//@import '~bootstrap/scss/mixins/breakpoints';
//@import '~@nebular/theme/styles/global/breakpoints';
//
@include nb-install-component() {
display: flex;
justify-content: space-between;
@ -18,14 +18,24 @@
flex-direction: row-reverse;
}
.logo-containter {
.logo-container {
display: flex;
align-items: center;
width: calc(#{nb-theme(sidebar-width)} - #{nb-theme(header-padding)});
}
.control-item {
display: block;
nb-action {
height: auto;
display: flex;
align-content: center;
}
nb-user {
cursor: pointer;
}
::ng-deep nb-search button {
padding: 0!important;
}
.header-container {
@ -34,179 +44,173 @@
width: auto;
.navigation {
@include nb-ltr(padding-right, nb-theme(padding));
@include nb-rtl(padding-left, nb-theme(padding));
font-size: 2.5rem;
@include nb-ltr(padding-right, 1.25rem);
@include nb-rtl(padding-left, 1.25rem);
text-decoration: none;
i {
display: block;
nb-icon {
font-size: 2.5rem;
}
}
.logo {
padding: 0 nb-theme(padding);
padding: 0 1.25rem;
font-size: 1.75rem;
font-weight: nb-theme(font-weight-bolder);
@include nb-ltr(border-left, 1px solid nb-theme(separator));
@include nb-rtl(border-right, 1px solid nb-theme(separator));
@include nb-ltr(border-left, 1px solid nb-theme(divider-color));
@include nb-rtl(border-right, 1px solid nb-theme(divider-color));
white-space: nowrap;
span {
font-weight: nb-theme(font-weight-normal);
}
}
}
@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 ::ng-deep ngx-theme-switcher .dropdown-toggle {
color: nb-theme(color-white);
background: transparent;
}
}
ngx-layout-direction-switcher {
margin: 0 1.5rem;
}
ngx-theme-switcher {
margin: nb-theme(layout-padding);
margin-top: 0;
margin-bottom: 0;
}
@include media-breakpoint-down(xl) {
ngx-layout-direction-switcher {
display: none;
}
}
.toggle-settings ::ng-deep a {
display: block;
text-decoration: none;
line-height: 1;
i {
color: nb-theme(color-fg-highlight);
font-size: 2.25rem;
border-radius: 50%;
position: relative;
animation-name: pulse-light;
&::after {
content: ' ';
// hack to be able to set border-radius
background-image: url('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
border-radius: 50%;
pointer-events: none;
position: absolute;
top: 52.3%;
left: 50%;
transform: translate(-50%, -50%);
width: 13%;
height: 13%;
animation: 3s linear infinite pulse;
@include nb-for-theme(default) {
animation-name: pulse-light;
}
}
}
}
@include keyframes(pulse) {
0% {
//box-shadow: 0 0 1px 0 rgba(nb-theme(color-fg-highlight), 0);
}
20% {
//box-shadow: 0 0 3px 10px rgba(nb-theme(color-fg-highlight), 0.4);
}
100% {
//box-shadow: 0 0 5px 20px rgba(nb-theme(color-fg-highlight), 0);
}
}
@include keyframes(pulse-light) {
0% {
box-shadow: 0 0 1px 0 rgba(115, 255, 208, 0);
}
20% {
box-shadow: 0 0 3px 10px rgba(115, 255, 208, 0.4);
}
100% {
box-shadow: 0 0 5px 20px rgba(115, 255, 208, 0);
}
}
@include media-breakpoint-down(md) {
nb-action:not(.toggle-settings) {
border: none;
}
.control-item {
display: none;
}
.toggle-settings {
padding: 0;
}
ngx-layout-direction-switcher {
display: none;
}
ngx-theme-switcher {
margin: 0 0.5rem;
}
}
@include media-breakpoint-down(sm) {
nb-user ::ng-deep .user-name {
display: none;
}
}
@include media-breakpoint-down(is) {
.header-container {
.logo {
font-size: 1.25rem;
}
}
.toggle-settings {
display: none;
}
ngx-theme-switcher {
display: none;
}
nb-action:not(.toggle-settings) {
padding: 0;
}
}
@include media-breakpoint-down(xs) {
.right ::ng-deep {
display: none;
text-decoration: none;
}
}
//
// @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 ::ng-deep ngx-theme-switcher .dropdown-toggle {
// color: nb-theme(color-white);
// background: transparent;
// }
// }
//
// ngx-layout-direction-switcher {
// margin: 0 1.5rem;
// }
//
// ngx-theme-switcher {
// margin: nb-theme(layout-padding);
// margin-top: 0;
// margin-bottom: 0;
// }
//
// @include media-breakpoint-down(xl) {
// ngx-layout-direction-switcher {
// display: none;
// }
// }
//
// .toggle-settings ::ng-deep a {
// display: block;
// text-decoration: none;
// line-height: 1;
//
// i {
// color: nb-theme(color-fg-highlight);
// font-size: 2.25rem;
// border-radius: 50%;
// position: relative;
// animation-name: pulse-light;
//
// &::after {
// content: ' ';
// // hack to be able to set border-radius
// background-image: url('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
// border-radius: 50%;
// pointer-events: none;
//
// position: absolute;
// top: 52.3%;
// left: 50%;
// transform: translate(-50%, -50%);
// width: 13%;
// height: 13%;
//
// animation: 3s linear infinite pulse;
//
// @include nb-for-theme(default) {
// animation-name: pulse-light;
// }
// }
// }
// }
//
// @include keyframes(pulse) {
// 0% {
// //box-shadow: 0 0 1px 0 rgba(nb-theme(color-fg-highlight), 0);
// }
// 20% {
// //box-shadow: 0 0 3px 10px rgba(nb-theme(color-fg-highlight), 0.4);
// }
// 100% {
// //box-shadow: 0 0 5px 20px rgba(nb-theme(color-fg-highlight), 0);
// }
// }
//
// @include keyframes(pulse-light) {
// 0% {
// box-shadow: 0 0 1px 0 rgba(115, 255, 208, 0);
// }
// 20% {
// box-shadow: 0 0 3px 10px rgba(115, 255, 208, 0.4);
// }
// 100% {
// box-shadow: 0 0 5px 20px rgba(115, 255, 208, 0);
// }
// }
//
// @include media-breakpoint-down(md) {
//
// nb-action:not(.toggle-settings) {
// border: none;
// }
//
// .control-item {
// display: none;
// }
//
// .toggle-settings {
// padding: 0;
// }
//
// ngx-layout-direction-switcher {
// display: none;
// }
//
// ngx-theme-switcher {
// margin: 0 0.5rem;
// }
// }
//
// @include media-breakpoint-down(sm) {
//
// nb-user ::ng-deep .user-name {
// display: none;
// }
// }
//
// @include media-breakpoint-down(is) {
//
// .header-container {
// .logo {
// font-size: 1.25rem;
// }
// }
//
// .toggle-settings {
// display: none;
// }
//
// ngx-theme-switcher {
// display: none;
// }
//
// nb-action:not(.toggle-settings) {
// padding: 0;
// }
// }
//
// @include media-breakpoint-down(xs) {
// .right ::ng-deep {
// display: none;
// }
// }
}

View file

@ -1,8 +1,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { NbMenuService, NbSidebarService, NbThemeService } from '@nebular/theme';
import { NbMenuService, NbSidebarService } from '@nebular/theme';
import { UserData } from '../../../@core/data/users';
import { AnalyticsService } from '../../../@core/utils';
import { LayoutService } from '../../../@core/utils';
@Component({
@ -16,12 +15,33 @@ export class HeaderComponent implements OnInit {
user: any;
userMenu = [{ title: 'Profile' }, { title: 'Log out' }];
themes = [
{
value: 'default',
name: 'Light',
},
{
value: 'dark',
name: 'Dark',
},
{
value: 'cosmic',
name: 'Cosmic',
},
{
value: 'corporate',
name: 'Corporate',
},
];
currentTheme = 'default';
userMenu = [ { title: 'Profile' }, { title: 'Log out' } ];
constructor(private sidebarService: NbSidebarService,
private menuService: NbMenuService,
private themeService: NbThemeService,
private userService: UserData,
private analyticsService: AnalyticsService,
private layoutService: LayoutService) {
}
@ -30,6 +50,10 @@ export class HeaderComponent implements OnInit {
.subscribe((users: any) => this.user = users.nick);
}
toggleTheme() {
this.themeService.changeTheme(this.currentTheme);
}
toggleSidebar(): boolean {
this.sidebarService.toggle(true, 'menu-sidebar');
this.layoutService.changeLayoutSize();
@ -37,11 +61,8 @@ export class HeaderComponent implements OnInit {
return false;
}
goToHome() {
navigateHome() {
this.menuService.navigateHome();
}
startSearch() {
this.analyticsService.trackEvent('startSearch');
return false;
}
}

View file

@ -2,9 +2,3 @@ export * from './header/header.component';
export * from './footer/footer.component';
export * from './search-input/search-input.component';
export * from './tiny-mce/tiny-mce.component';
export * from './theme-settings/theme-settings.component';
export * from './theme-switcher/theme-switcher.component';
export * from './switcher/switcher.component';
export * from './layout-direction-switcher/layout-direction-switcher.component';
export * from './theme-switcher/themes-switcher-list/themes-switcher-list.component';
export * from './toggle-settings-button/toggle-settings-button.component';

View file

@ -1,42 +0,0 @@
import { Component, OnDestroy, Input } from '@angular/core';
import { NbLayoutDirectionService, NbLayoutDirection } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators';
@Component({
selector: 'ngx-layout-direction-switcher',
template: `
<ngx-switcher
[firstValue]="directions.RTL"
[secondValue]="directions.LTR"
[firstValueLabel]="'RTL'"
[secondValueLabel]="'LTR'"
[value]="currentDirection"
(valueChange)="toggleDirection($event)"
[vertical]="vertical"
>
</ngx-switcher>
`,
})
export class LayoutDirectionSwitcherComponent implements OnDestroy {
directions = NbLayoutDirection;
currentDirection: NbLayoutDirection;
alive = true;
@Input() vertical: boolean = false;
constructor(private directionService: NbLayoutDirectionService) {
this.currentDirection = this.directionService.getDirection();
this.directionService.onDirectionChange()
.pipe(takeWhile(() => this.alive))
.subscribe(newDirection => this.currentDirection = newDirection);
}
toggleDirection(newDirection) {
this.directionService.setDirection(newDirection);
}
ngOnDestroy() {
this.alive = false;
}
}

View file

@ -1,112 +0,0 @@
//@import '../../styles/themes';
//@import '~@nebular/bootstrap/styles/hero-buttons';
//@import '~bootstrap/scss/mixins/breakpoints';
//@import '~@nebular/theme/styles/global/breakpoints';
//
//@include nb-install-component() {
// .switch-label {
// display: flex;
// justify-content: space-between;
// align-items: center;
// cursor: pointer;
// margin: 0;
//
// &.vertical {
// flex-direction: column;
// align-items: flex-start;
//
// .first,
// .second {
// padding: 0;
// }
//
// .switch {
// margin-top: 0.5em;
// }
// }
//
// & > span {
// font-size: 1.125rem;
// font-weight: nb-theme(font-weight-bold);
// transition: opacity 0.3s ease;
// color: nb-theme(color-fg);
//
// &.first {
// @include nb-ltr(padding-right, 10px);
// @include nb-rtl(padding-left, 10px);
// }
//
// &.second {
// @include nb-ltr(padding-left, 10px);
// @include nb-rtl(padding-right, 10px);
// }
//
// &.active {
// color: nb-theme(color-fg-text);
// }
//
// @include nb-for-theme(cosmic) {
// color: nb-theme(color-fg);
//
// &.active {
// color: nb-theme(color-white);
// }
// }
//
// &:active {
// opacity: 0.78;
// }
// }
// }
//
// .switch {
// position: relative;
// display: inline-block;
// width: 3rem;
// height: 1.5rem;
// margin: 0;
//
// input {
// display: none;
//
// &:checked + .slider::before {
// @include nb-ltr(transform, translateX(1.5rem));
// @include nb-rtl(transform, translateX(-1.5rem));
// }
// }
//
// .slider {
// position: absolute;
// top: 0;
// left: 0;
// right: 0;
// bottom: 0;
// border-radius: 1.75rem;
// background-color: nb-theme(layout-bg);
// }
//
// .slider::before {
// position: absolute;
// content: '';
// height: 1.5rem;
// width: 1.5rem;
// border-radius: 50%;
// background-color: nb-theme(color-success);
// transition: 0.2s;
//
// //box-shadow: 0 0 0.25rem 0 rgba(nb-theme(color-fg), 0.4);
//
// @include nb-for-theme(cosmic) {
// @include btn-hero-primary-gradient();
// }
//
// @include nb-for-theme(corporate) {
// background-color: nb-theme(color-primary);
// }
// }
// }
//
// @include media-breakpoint-down(xs) {
// align-items: flex-end;
// }
//}

View file

@ -1,60 +0,0 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'ngx-switcher',
styleUrls: ['./switcher.component.scss'],
template: `
<label class="switch-label" [class.vertical]="vertical">
<span class="first" [class.active]="vertical || isFirstValue()">
{{vertical ? currentValueLabel() : firstValueLabel}}
</span>
<div class="switch">
<input type="checkbox" [checked]="isSecondValue()" (change)="changeValue()">
<span class="slider"></span>
</div>
<span
*ngIf="!vertical"
class="second"
[class.active]="isSecondValue()"
>
{{secondValueLabel}}
</span>
</label>
`,
})
export class SwitcherComponent {
@Input() firstValue: any;
@Input() secondValue: any;
@Input() firstValueLabel: string;
@Input() secondValueLabel: string;
@Input() vertical: boolean;
@Input() value: any;
@Output() valueChange = new EventEmitter<any>();
isFirstValue() {
return this.value === this.firstValue;
}
isSecondValue() {
return this.value === this.secondValue;
}
currentValueLabel() {
return this.isFirstValue()
? this.firstValueLabel
: this.secondValueLabel;
}
changeValue() {
this.value = this.isFirstValue()
? this.secondValue
: this.firstValue;
this.valueChange.emit(this.value);
}
}

View file

@ -1,91 +0,0 @@
@import '../../styles/themes';
@include nb-install-component() {
h6 {
margin-bottom: 0.875rem;
text-align: center;
font-weight: bold;
text-shadow: 0 0 8px rgba(0, 0, 0, 0.16);
}
.settings-row {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-wrap: wrap;
width: 100%;
margin: 0 0 2.575rem;
a {
display: flex;
justify-content: center;
align-content: center;
align-items: center;
width: 4.15rem;
height: 4.15rem;
border-radius: nb-theme(radius);
background-color: nb-theme(color-white);
border: 2px solid transparent;
margin: 0.875rem;
text-decoration: none;
font-size: 2.25rem;
color: nb-theme(color-fg);
&.selected {
color: nb-theme(color-success);
border-color: nb-theme(color-success);
}
@include nb-for-theme(cosmic) {
box-shadow: 0 4px 14px 0 rgba(19, 19, 94, 0.4);
background-color: #3e367e;
border: 2px solid #3e367e;
&.selected {
color: nb-theme(link-color);
}
}
}
}
.settings {
margin-bottom: 1em;
}
.switcher {
margin-bottom: 1rem;
font-size: 1.524rem;
width: 12rem;
::ng-deep ngx-switcher {
.switch-label span {
font-size: 1em;
font-weight: normal;
&.first, &.second {
font-size: 1rem;
}
}
.switch {
height: 1.5em;
width: 3em;
.slider::before {
height: 1.5em;
width: 1.5em;
}
input:checked + .slider::before {
@include nb-ltr(transform, translateX(1.5em)!important);
@include nb-rtl(transform, translateX(-1.5em)!important);
}
}
@include nb-for-theme(cosmic) {
.switch .slider {
background-color: nb-theme(color-bg);
}
}
}
}
}

View file

@ -1,70 +0,0 @@
import { Component } from '@angular/core';
import { StateService } from '../../../@core/utils';
@Component({
selector: 'ngx-theme-settings',
styleUrls: ['./theme-settings.component.scss'],
template: `
<h6>LAYOUTS</h6>
<div class="settings-row">
<a *ngFor="let layout of layouts"
href="#"
[class.selected]="layout.selected"
[attr.title]="layout.name"
(click)="layoutSelect(layout)">
<i [attr.class]="layout.icon"></i>
</a>
</div>
<h6>SIDEBAR</h6>
<div class="settings-row">
<a *ngFor="let sidebar of sidebars"
href="#"
[class.selected]="sidebar.selected"
[attr.title]="sidebar.name"
(click)="sidebarSelect(sidebar)">
<i [attr.class]="sidebar.icon"></i>
</a>
</div>
<div class="settings-row">
<div class="switcher">
<ngx-layout-direction-switcher></ngx-layout-direction-switcher>
</div>
</div>
`,
})
export class ThemeSettingsComponent {
layouts = [];
sidebars = [];
constructor(protected stateService: StateService) {
this.stateService.getLayoutStates()
.subscribe((layouts: any[]) => this.layouts = layouts);
this.stateService.getSidebarStates()
.subscribe((sidebars: any[]) => this.sidebars = sidebars);
}
layoutSelect(layout: any): boolean {
this.layouts = this.layouts.map((l: any) => {
l.selected = false;
return l;
});
layout.selected = true;
this.stateService.setLayoutState(layout);
return false;
}
sidebarSelect(sidebars: any): boolean {
this.sidebars = this.sidebars.map((s: any) => {
s.selected = false;
return s;
});
sidebars.selected = true;
this.stateService.setSidebarState(sidebars);
return false;
}
}

View file

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

View file

@ -1,50 +0,0 @@
@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);
$percentage: nb-theme(switcher-background-percentage);
background-color: tint($color, $percentage);
}
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,19 +0,0 @@
import { Component, Input, ViewChild } from '@angular/core';
import { NbPopoverDirective } from '@nebular/theme';
import { NbJSThemeOptions } from '@nebular/theme/services/js-themes/theme.options';
import { ThemeSwitcherListComponent } from './themes-switcher-list/themes-switcher-list.component';
@Component({
selector: 'ngx-theme-switcher',
templateUrl: './theme-switcher.component.html',
styleUrls: ['./theme-switcher.component.scss'],
})
export class ThemeSwitcherComponent {
@ViewChild(NbPopoverDirective, { static: true }) popover: NbPopoverDirective;
@Input() showTitle: boolean = true;
switcherListComponent = ThemeSwitcherListComponent;
theme: NbJSThemeOptions;
}

View file

@ -1,76 +0,0 @@
@import '../../../styles/themes';
@import '~@nebular/theme/styles/core/mixins';
@import '~bootstrap/scss/mixins/breakpoints';
@import '~@nebular/theme/styles/global/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() {
::ng-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) {
::ng-deep .themes-switcher-list {
display: none;
}
}
}

View file

@ -1,51 +0,0 @@
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

@ -1,118 +0,0 @@
//@import '../../styles/themes';
//@import '~bootstrap/scss/mixins/breakpoints';
//@import '~@nebular/theme/styles/global/breakpoints';
////@import '~@nebular/bootstrap/styles/hero-buttons';
//
//@include nb-install-component() {
// .toggle-settings {
// position: fixed;
// top: 50%;
// height: 3rem;
// width: 3rem;
// padding: 0;
// text-align: center;
// border: none;
// transition: transform 0.3s ease, background-image 0.3s ease;
// transform: translate(0, -50%);
// z-index: 998;
//
// @include nb-ltr() {
// border-top-left-radius: nb-theme(radius);
// border-bottom-left-radius: nb-theme(radius);
// right: 0;
//
// &.sidebar-end {
// border-top-left-radius: 0;
// border-bottom-left-radius: 0;
// right: auto;
// border-top-right-radius: nb-theme(radius);
// border-bottom-right-radius: nb-theme(radius);
// left: 0;
// }
// }
//
// @include nb-rtl() {
// border-top-right-radius: nb-theme(radius);
// border-bottom-right-radius: nb-theme(radius);
// left: 0;
//
// &.sidebar-end {
// border-top-right-radius: 0;
// border-bottom-right-radius: 0;
// left: auto;
// border-top-left-radius: nb-theme(radius);
// border-bottom-left-radius: nb-theme(radius);
// right: 0;
// }
// }
//
// &.expanded {
// @include nb-ltr(transform, translate(-19rem, -50%));
// @include nb-rtl(transform, translate(19rem, -50%));
//
// &.sidebar-end {
// @include nb-rtl(transform, translate(-19rem, -50%));
// @include nb-ltr(transform, translate(19rem, -50%));
// }
// }
//
// @include nb-for-theme(cosmic) {
// box-shadow: 0 0 3.4285rem 0 rgba(19, 19, 94, 0.72);
// @include btn-hero-success-gradient();
// }
//
// @include nb-for-theme(default) {
// border: 1px solid #d5dbe0;
// box-shadow: 0 8px 24px 0 rgba(48, 59, 67, 0.15);
// background-color: #ffffff;
// }
//
// @include nb-for-theme(corporate) {
// border: 1px solid #d5dbe0;
// box-shadow: 0 8px 24px 0 rgba(48, 59, 67, 0.15);
// color: nb-theme(color-danger);
// background-color: #ffffff;
// }
//
// i {
// font-size: 2.75rem;
// color: #ffffff;
// display: block;
//
//
// @include nb-for-theme(default) {
// color: nb-theme(color-danger);
// }
//
// @include nb-for-theme(corporate) {
// color: nb-theme(color-warning);
// }
// }
//
// &:not(.was-expanded) i {
// animation-name: gear-pulse;
// animation-duration: 1s;
// animation-iteration-count: infinite;
// }
//
// @keyframes gear-pulse {
// from {
// transform: scale3d(1, 1, 1);
// }
//
// 50% {
// transform: scale3d(1.2, 1.2, 1.2);
// }
//
// to {
// transform: scale3d(1, 1, 1);
// }
// }
// }
//
// @include media-breakpoint-down(sm) {
// .toggle-settings {
// display: none;
// }
// }
//}

View file

@ -1,37 +0,0 @@
import { Component } from '@angular/core';
import { NbSidebarService } from '@nebular/theme';
import { StateService } from '../../../@core/utils';
@Component({
selector: 'ngx-toggle-settings-button',
styleUrls: ['./toggle-settings-button.component.scss'],
template: `
<button class="toggle-settings"
(click)="toggleSettings()"
[class.expanded]="expanded"
[class.sidebar-end]="sidebarEnd"
[class.was-expanded]="wasExpanded"
>
<i class="nb-gear"></i>
</button>
`,
})
export class ToggleSettingsButtonComponent {
sidebarEnd = false;
expanded = false;
wasExpanded = false;
constructor(private sidebarService: NbSidebarService, protected stateService: StateService) {
this.stateService.onSidebarState()
.subscribe(({id}) => {
this.sidebarEnd = id === 'end';
});
}
toggleSettings() {
this.sidebarService.toggle(false, 'settings-sidebar');
this.expanded = !this.expanded;
this.wasExpanded = true;
}
}