refactor(app): make a bit more neat structure

This commit is contained in:
Dmitry Nehaychik 2017-04-28 14:59:24 +03:00
parent 91c780c256
commit 44f2f562a9
20 changed files with 24 additions and 17 deletions

View file

@ -0,0 +1,16 @@
@mixin base-header-theme() {
/deep/ base-header {
.logo > a {
color: $nga-color-secondary !important;
@include hover-focus-active {
color: $nga-color-inverse !important;
}
}
.left > *,
.right > * {
border-color: rgba($nga-color-inverse, 0.2);
}
}
}

View file

@ -0,0 +1,75 @@
:host {
width: 100%;
display: flex;
justify-content: space-between;
i.control-icon {
&::before {
font-size: 2.3rem;
}
&:hover {
cursor: pointer;
}
}
div {
display: flex;
align-items: center;
& > * {
height: 100%;
display: flex;
align-items: center;
}
}
.left {
> * {
padding: 0 1.25rem;
border-right-width: 1px;
border-right-style: solid;
&:first-child {
padding-left: 0;
}
&:last-child {
border: none;
}
}
.control-icon.ion-navicon {
font-size: 2.8rem;
}
.logo {
font-size: 1.7rem;
font-weight: bold;
text-decoration: none;
transition: all 0.2s ease;
cursor: pointer;
a {
font-weight: normal;
}
}
}
.right {
> * {
padding: 0 1.25rem;
border-left-width: 1px;
border-left-style: solid;
&:first-child {
border: none;
}
&:last-child {
padding-right: 0;
}
}
}
}

View file

@ -0,0 +1,45 @@
import { Component } from '@angular/core';
import { NgaSidebarService, NgaMenuService } from '@nga/theme';
import { NgaThemeService } from '@nga/theme/services/theme.service';
@Component({
selector: 'base-header',
styleUrls: ['./base-header.component.scss'],
template: `
<div class="left">
<i class="control-icon ion ion-navicon" (click)="toggleSidebar()"></i>
<span class="logo" (click)="goToHome()">NgX&nbsp;<a>Admin</a></span>
<button (click)="switchTheme()">Switch Theme!</button>
</div>
<div class="right">
<search-input></search-input>
<i class="control-icon ion ion-ios-email-outline"></i>
<i class="control-icon ion ion-ios-bell-outline"></i>
<nga-user></nga-user>
<i class="control-icon ion ion-ios-gear-outline"></i>
</div>
`,
})
export class BaseHeaderComponent {
constructor(private sidebarService: NgaSidebarService,
private menuService: NgaMenuService,
private themeService: NgaThemeService) {
}
toggleSidebar() {
this.sidebarService.toggle(true);
}
goToHome() {
this.menuService.navigateHome();
}
switchTheme() {
if (this.themeService.currentTheme == 'pure') {
this.themeService.changeTheme('gorgeous');
} else {
this.themeService.changeTheme('pure');
}
}
}