mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
refactor(@theme): refactor style system
This commit is contained in:
parent
e0f79206bb
commit
0992b52b24
14 changed files with 214 additions and 113 deletions
|
|
@ -0,0 +1,24 @@
|
|||
@mixin base-header-theme() {
|
||||
/deep/ base-header {
|
||||
i.control-icon {
|
||||
&:hover {
|
||||
color: $nga-color-secondary;
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
span {
|
||||
color: $nga-color-secondary;
|
||||
}
|
||||
|
||||
&:hover span {
|
||||
color: $nga-color-default;
|
||||
}
|
||||
}
|
||||
|
||||
.left > *,
|
||||
.right > * {
|
||||
border-color: rgba($nga-color-default, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
: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;
|
||||
}
|
||||
|
||||
.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;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
> * {
|
||||
padding: 0 1.25rem;
|
||||
border-left-width: 1px;
|
||||
border-left-style: solid;
|
||||
|
||||
&:first-child {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
29
src/app/@theme/layouts/base-header/base-header.component.ts
Normal file
29
src/app/@theme/layouts/base-header/base-header.component.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
import { NgaSidebarService } from '@nga/theme/components/sidebar/sidebar.service';
|
||||
|
||||
@Component({
|
||||
selector: 'base-header',
|
||||
styleUrls: ['./base-header.component.scss'],
|
||||
template: `
|
||||
<div class="left">
|
||||
<i class="control-icon ion ion-navicon" (click)="toggleSidebar()"></i>
|
||||
<a href="/#/pages/dashboard" class="logo">NgX <span>Admin</span></a>
|
||||
</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) {
|
||||
}
|
||||
|
||||
toggleSidebar() {
|
||||
this.sidebarService.toggle(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1,2 @@
|
|||
export * from './base-header/base-header.component';
|
||||
export * from './one-coll-layout/one-coll.layout';
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
@import '../../styles/pure/pure.redefines';
|
||||
|
||||
:host /deep/ {
|
||||
nga-layout-header > nav {
|
||||
justify-content: space-between;
|
||||
|
||||
i.control-icon {
|
||||
font-size: 2.3rem;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
color: $nga-color-secondary;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.left {
|
||||
> * {
|
||||
padding: 0 1.25rem;
|
||||
border-right: 1px solid rgba($nga-color-default, 0.2);
|
||||
|
||||
&:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.control-icon.ion-navicon {
|
||||
font-size: 2.8rem;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 1.7rem;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
span {
|
||||
color: $nga-color-secondary;
|
||||
}
|
||||
|
||||
&:hover span {
|
||||
color: $nga-color-default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
> * {
|
||||
padding: 0 1.25rem;
|
||||
border-left: 1px solid rgba($nga-color-default, 0.2);
|
||||
|
||||
&:first-child {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nga-sidebar {
|
||||
|
||||
}
|
||||
|
||||
nga-layout-footer > nav {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,11 @@
|
|||
/*
|
||||
* TODO
|
||||
* I think we need to store our header, footer,
|
||||
* sedibars and etc. separetly, each in it's own
|
||||
* component.
|
||||
*
|
||||
* And of course we need to make this layout part
|
||||
* reusable.
|
||||
* */
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { NgaSidebarService } from '@nga/theme/components/sidebar/sidebar.service';
|
||||
|
||||
@Component({
|
||||
selector: 'one-coll-layout',
|
||||
styleUrls: ['./one-coll.layout.scss'],
|
||||
template: `
|
||||
<nga-layout>
|
||||
<nga-layout-header fixed>
|
||||
<div class="left">
|
||||
<i class="control-icon ion ion-navicon" (click)="toggleSidebar()"></i>
|
||||
<a href="/#/pages/dashboard" class="logo">NgX <span>Admin</span></a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<i class="control-icon ion ion-ios-search"></i>
|
||||
<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>
|
||||
<base-header></base-header>
|
||||
</nga-layout-header>
|
||||
|
||||
<nga-sidebar>
|
||||
|
|
@ -46,10 +24,4 @@ import { NgaSidebarService } from '@nga/theme/components/sidebar/sidebar.service
|
|||
`,
|
||||
})
|
||||
export class OneCollLayoutComponent {
|
||||
constructor(private sidebarService: NgaSidebarService) {
|
||||
}
|
||||
|
||||
toggleSidebar() {
|
||||
this.sidebarService.toggle(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
@mixin search-input-theme() {
|
||||
/deep/ search-input {
|
||||
i.control-icon {
|
||||
&:hover {
|
||||
color: $nga-color-secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/app/@theme/search-input/search-input.component.scss
Normal file
27
src/app/@theme/search-input/search-input.component.scss
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
:host {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
i.control-icon {
|
||||
&:before {
|
||||
font-size: 2.3rem;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
border: none;
|
||||
outline: none;
|
||||
margin-left: 1rem;
|
||||
width: 15rem;
|
||||
transition: width 0.2s ease;
|
||||
|
||||
&.hidden {
|
||||
width: 0;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/app/@theme/search-input/search-input.component.ts
Normal file
35
src/app/@theme/search-input/search-input.component.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { Component, ElementRef, EventEmitter, Output, ViewChild } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'search-input',
|
||||
styleUrls: ['./search-input.component.scss'],
|
||||
template: `
|
||||
<i class="control-icon ion ion-ios-search"
|
||||
(click)="showInput()"></i>
|
||||
<input placeholder="Type your search request here..."
|
||||
#input
|
||||
[class.hidden]="!isInputShown"
|
||||
(blur)="hideInput()"
|
||||
(input)="onInput($event)">
|
||||
`
|
||||
})
|
||||
export class SearchInputComponent {
|
||||
@ViewChild('input') input: ElementRef;
|
||||
|
||||
@Output() search: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
||||
isInputShown: boolean = false;
|
||||
|
||||
showInput() {
|
||||
this.isInputShown = true;
|
||||
this.input.nativeElement.focus();
|
||||
}
|
||||
|
||||
hideInput() {
|
||||
this.isInputShown = false;
|
||||
}
|
||||
|
||||
onInput(val: string) {
|
||||
this.search.emit(val);
|
||||
}
|
||||
}
|
||||
7
src/app/@theme/styles/pure/_pure.components.scss
Normal file
7
src/app/@theme/styles/pure/_pure.components.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@import '../../layouts/base-header/base-header.component.theme';
|
||||
@import '../../search-input/search-input.component.theme';
|
||||
|
||||
@mixin custom-components-theme() {
|
||||
@include base-header-theme();
|
||||
@include search-input-theme();
|
||||
}
|
||||
|
|
@ -21,10 +21,15 @@ $nga-user-picture-background: $nga-color-default;
|
|||
|
||||
$nga-sidebar-background: $nga-background;
|
||||
$nga-sidebar-width: 16.25rem;
|
||||
$nga-sidebar-width-compact: 3.45rem;
|
||||
|
||||
:host /deep/ {
|
||||
color: $nga-color-default;
|
||||
|
||||
input {
|
||||
color: $nga-color-default;
|
||||
}
|
||||
|
||||
nga-layout {
|
||||
nga-layout-header > nav {
|
||||
box-shadow: 0 4px 12px 0 rgba(33, 57, 161, 0.08);
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
@import '~@nga/theme/styles/themes/nga.theme.default';
|
||||
|
||||
@import 'pure.components';
|
||||
@import 'pure.redefines';
|
||||
|
||||
@include nga-theme();
|
||||
@include custom-components-theme();
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
@import "pure/pure.theme";
|
||||
@import 'pure/pure.theme';
|
||||
|
|
@ -12,7 +12,8 @@ import {
|
|||
NgaUserModule
|
||||
} from '@nga/theme';
|
||||
|
||||
import { OneCollLayoutComponent } from './layouts';
|
||||
import { SearchInputComponent } from './search-input/search-input.component';
|
||||
import { OneCollLayoutComponent, BaseHeaderComponent } from './layouts';
|
||||
|
||||
const BASE_MODULES = [
|
||||
CommonModule,
|
||||
|
|
@ -29,8 +30,9 @@ const NGA_MODULES = [
|
|||
NgaUserModule
|
||||
];
|
||||
|
||||
const LAYOUT_COMPONENTS = [
|
||||
OneCollLayoutComponent
|
||||
const LAYOUTS = [
|
||||
OneCollLayoutComponent,
|
||||
BaseHeaderComponent
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
@ -42,11 +44,12 @@ const LAYOUT_COMPONENTS = [
|
|||
exports: [
|
||||
...BASE_MODULES,
|
||||
...NGA_MODULES,
|
||||
...LAYOUT_COMPONENTS,
|
||||
NgaSidebarModule
|
||||
...LAYOUTS,
|
||||
SearchInputComponent
|
||||
],
|
||||
declarations: [
|
||||
...LAYOUT_COMPONENTS
|
||||
...LAYOUTS,
|
||||
SearchInputComponent
|
||||
]
|
||||
})
|
||||
export class ThemeModule {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue