mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-04-18 01:59:04 +02:00
refactor(e-commerce): traffic
This commit is contained in:
parent
368a35110d
commit
0af864e19e
11 changed files with 58 additions and 183 deletions
|
|
@ -47,6 +47,9 @@ $nb-themes: nb-register-theme((
|
||||||
), default, default);
|
), default, default);
|
||||||
|
|
||||||
$nb-themes: nb-register-theme((
|
$nb-themes: nb-register-theme((
|
||||||
|
|
||||||
|
card-height-tiny: 13.5rem,
|
||||||
|
select-min-width: 6rem,
|
||||||
// app wise variables for each theme
|
// app wise variables for each theme
|
||||||
//sidebar-header-gap: 2rem,
|
//sidebar-header-gap: 2rem,
|
||||||
//sidebar-header-height: initial,
|
//sidebar-header-height: initial,
|
||||||
|
|
@ -83,6 +86,9 @@ $nb-themes: nb-register-theme((
|
||||||
), cosmic, cosmic);
|
), cosmic, cosmic);
|
||||||
|
|
||||||
$nb-themes: nb-register-theme((
|
$nb-themes: nb-register-theme((
|
||||||
|
|
||||||
|
card-height-tiny: 13.5rem,
|
||||||
|
select-min-width: 6rem,
|
||||||
// app wise variables for each theme
|
// app wise variables for each theme
|
||||||
//sidebar-header-gap: 2rem,
|
//sidebar-header-gap: 2rem,
|
||||||
//sidebar-header-height: initial,
|
//sidebar-header-height: initial,
|
||||||
|
|
@ -117,3 +123,8 @@ $nb-themes: nb-register-theme((
|
||||||
//
|
//
|
||||||
//progress-bar-background: linear-gradient(90deg, #ff9f6f 0%, #ff8b97 100%),
|
//progress-bar-background: linear-gradient(90deg, #ff9f6f 0%, #ff8b97 100%),
|
||||||
), corporate, corporate);
|
), corporate, corporate);
|
||||||
|
|
||||||
|
$nb-themes: nb-register-theme((
|
||||||
|
card-height-tiny: 13.5rem,
|
||||||
|
select-min-width: 6rem,
|
||||||
|
), dark, dark);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import {
|
||||||
NbUserModule,
|
NbUserModule,
|
||||||
NbIconModule,
|
NbIconModule,
|
||||||
NbSelectModule,
|
NbSelectModule,
|
||||||
|
NbListModule,
|
||||||
} from '@nebular/theme';
|
} from '@nebular/theme';
|
||||||
import { NgxEchartsModule } from 'ngx-echarts';
|
import { NgxEchartsModule } from 'ngx-echarts';
|
||||||
import { NgxChartsModule } from '@swimlane/ngx-charts';
|
import { NgxChartsModule } from '@swimlane/ngx-charts';
|
||||||
|
|
@ -64,6 +65,7 @@ import { EarningLiveUpdateChartComponent } from './earning-card/front-side/earni
|
||||||
NbIconModule,
|
NbIconModule,
|
||||||
NbTabsetModule,
|
NbTabsetModule,
|
||||||
NbSelectModule,
|
NbSelectModule,
|
||||||
|
NbListModule,
|
||||||
ChartModule,
|
ChartModule,
|
||||||
NbProgressBarModule,
|
NbProgressBarModule,
|
||||||
NgxEchartsModule,
|
NgxEchartsModule,
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,17 @@
|
||||||
ngx-traffic-bar-chart {
|
ngx-traffic-bar-chart {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep canvas {
|
::ng-deep {
|
||||||
border-bottom-left-radius: nb-theme(card-border-radius);
|
canvas {
|
||||||
border-bottom-right-radius: nb-theme(card-border-radius);
|
border-bottom-left-radius: nb-theme(card-border-radius);
|
||||||
}
|
border-bottom-right-radius: nb-theme(card-border-radius);
|
||||||
|
}
|
||||||
|
|
||||||
.echart {
|
.echart {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ declare const echarts: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ngx-traffic-bar-chart',
|
selector: 'ngx-traffic-bar-chart',
|
||||||
styleUrls: ['traffic-back-card.component.scss'],
|
|
||||||
template: `
|
template: `
|
||||||
<div echarts
|
<div echarts
|
||||||
[options]="option"
|
[options]="option"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
@import '../../../../../@theme/styles/themes';
|
@import '../../../../../@theme/styles/themes';
|
||||||
//@import '~@nebular/bootstrap/styles/hero-buttons';
|
|
||||||
@import '~@nebular/theme/styles/global/typography/typography';
|
|
||||||
|
|
||||||
$traffic-bar-background-color: #d0d8e3;
|
|
||||||
|
|
||||||
@include nb-install-component() {
|
@include nb-install-component() {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
@ -26,8 +22,7 @@ $traffic-bar-background-color: #d0d8e3;
|
||||||
|
|
||||||
.period-from {
|
.period-from {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 100%;
|
@include nb-ltr(right, 100%);
|
||||||
@include nb-rtl(right, inherit);
|
|
||||||
@include nb-rtl(left, 100%);
|
@include nb-rtl(left, 100%);
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
@ -40,32 +35,13 @@ $traffic-bar-background-color: #d0d8e3;
|
||||||
|
|
||||||
.progress-line {
|
.progress-line {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: $traffic-bar-background-color;
|
|
||||||
|
|
||||||
&.success {
|
&.success {
|
||||||
background-color: text-success();
|
background-color: nb-theme(color-success-default);
|
||||||
|
|
||||||
@include nb-for-theme(corporate) {
|
|
||||||
background-color: text-primary();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.failure {
|
&.failure {
|
||||||
background-color: text-danger();
|
background-color: nb-theme(color-danger-default);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include nb-for-theme(cosmic) {
|
|
||||||
.progress-line {
|
|
||||||
background: linear-gradient(180deg, #a054fe 0%, #7a58ff 100%);
|
|
||||||
|
|
||||||
&.success {
|
|
||||||
background: linear-gradient(0deg, #00caba 0%, #00d77f 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.failure {
|
|
||||||
background: linear-gradient(180deg, #ff38ab 0%, #ff386c 100%);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
<nb-card-body>
|
<nb-list>
|
||||||
<ul class="traffic-list">
|
<nb-list-item class="item" *ngFor="let item of frontCardData; trackBy: trackByDate">
|
||||||
<li *ngFor="let item of frontCardData; trackBy: trackByDate">
|
<span class="caption">{{ item.date }}</span>
|
||||||
<div class="date">{{ item.date }}</div>
|
<span>{{ item.value }}</span>
|
||||||
<div class="value">{{ item.value }}</div>
|
<span class="delta" [class.up]="item.delta.up" [class.down]="!item.delta.up">
|
||||||
<div class="delta"
|
{{ item.delta.value }}%
|
||||||
[class.up]="item.delta.up"
|
</span>
|
||||||
[class.down]="!item.delta.up">
|
<ngx-traffic-bar [barData]="item.comparison" [successDelta]="item.delta.up">
|
||||||
{{ item.delta.value }}%
|
</ngx-traffic-bar>
|
||||||
</div>
|
</nb-list-item>
|
||||||
<ngx-traffic-bar [barData]="item.comparison"
|
</nb-list>
|
||||||
[successDelta]="item.delta.up">
|
|
||||||
</ngx-traffic-bar>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nb-card-body>
|
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,21 @@
|
||||||
@import '../../../../@theme/styles/themes';
|
|
||||||
@import '~@nebular/theme/components/card/card.component.theme';
|
|
||||||
@import '~@nebular/theme/styles/global/typography/typography';
|
|
||||||
@import '~bootstrap/scss/mixins/breakpoints';
|
@import '~bootstrap/scss/mixins/breakpoints';
|
||||||
@import '~@nebular/theme/styles/global/breakpoints';
|
@import '~@nebular/theme/styles/global/breakpoints';
|
||||||
|
@import '../../../../@theme/styles/themes';
|
||||||
|
|
||||||
@include nb-install-component() {
|
@include nb-install-component() {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
nb-card-body {
|
nb-card-body {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
position: relative;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.traffic-list {
|
.item {
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 4.5rem;
|
height: 4.5rem;
|
||||||
font-size: 1.25rem;
|
|
||||||
position: relative;
|
|
||||||
color: nb-theme(color-fg);
|
|
||||||
padding: 1rem nb-theme(card-padding);
|
|
||||||
border-bottom:
|
|
||||||
nb-theme(list-item-border-width)
|
|
||||||
nb-theme(card-header-border-type)
|
|
||||||
nb-theme(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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
flex: 2;
|
flex: 2;
|
||||||
|
|
@ -58,94 +26,34 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.date {
|
|
||||||
@include nb-for-theme(corporate) {
|
|
||||||
color: nb-theme(color-fg-heading);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
color: nb-theme(color-fg-heading);
|
|
||||||
}
|
|
||||||
|
|
||||||
.delta {
|
.delta {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding-left: 0.5rem;
|
|
||||||
font-size: 1rem;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
right: 100%;
|
right: 100%;
|
||||||
margin-right: 0.7rem;
|
@include nb-ltr(margin-right, 0.7rem);
|
||||||
@include nb-rtl(margin-left, 0.7rem);
|
@include nb-rtl(margin-left, 0.7rem);
|
||||||
@include nb-rtl(margin-right, 0);
|
|
||||||
border-left: 5px solid transparent;
|
border-left: 5px solid transparent;
|
||||||
border-right: 5px solid transparent;
|
border-right: 5px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.down {
|
&.down {
|
||||||
color: text-danger();
|
color: nb-theme(color-danger-default);
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
bottom: 5px;
|
bottom: 5px;
|
||||||
border-top: 6px solid text-danger();
|
border-top: 6px solid nb-theme(color-danger-default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.up {
|
&.up {
|
||||||
color: text-success();
|
color: nb-theme(color-success-default);
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
top: 5px;
|
top: 5px;
|
||||||
border-bottom: 6px solid text-success();
|
border-bottom: 6px solid nb-theme(color-success-default);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include nb-for-theme(cosmic) {
|
|
||||||
.traffic-list li {
|
|
||||||
&: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) {
|
|
||||||
.traffic-list li {
|
|
||||||
border-color: nb-theme(tabs-separator);
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
border-top:
|
|
||||||
nb-theme(list-item-border-width)
|
|
||||||
nb-theme(card-header-border-type)
|
|
||||||
nb-theme(separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
&::before {
|
|
||||||
background-color: nb-theme(color-primary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.date {
|
|
||||||
color: nb-theme(color-fg-heading);
|
|
||||||
}
|
|
||||||
|
|
||||||
.delta {
|
|
||||||
&.up {
|
|
||||||
color: text-primary();
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
border-bottom-color: text-primary();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,6 @@
|
||||||
<nb-card-header>
|
<nb-card-header>
|
||||||
<span>Traffic</span>
|
<span>Traffic</span>
|
||||||
<div class="dropdown ghost-dropdown" ngbDropdown>
|
<nb-select [selected]="type" (selectedChange)="changePeriod($event)">
|
||||||
<button type="button" class="btn btn-sm" ngbDropdownToggle
|
<nb-option *ngFor="let period of types" [value]="period">{{ period }}</nb-option>
|
||||||
[ngClass]="{
|
</nb-select>
|
||||||
'btn-success': currentTheme === 'default',
|
|
||||||
'btn-primary': currentTheme !== 'default'}">
|
|
||||||
{{ type }}
|
|
||||||
</button>
|
|
||||||
<ul ngbDropdownMenu class="dropdown-menu">
|
|
||||||
<li class="dropdown-item" *ngFor="let period of types" (click)="changePeriod(period)">
|
|
||||||
{{ period }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nb-card-header>
|
</nb-card-header>
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,11 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0.675rem 4rem 0.5rem 1.25rem;
|
padding: nb-theme(card-padding);
|
||||||
@include nb-rtl(padding-right, 1.25rem);
|
padding-top: 0.45rem;
|
||||||
|
padding-bottom: 0.45rem;
|
||||||
|
|
||||||
|
@include nb-ltr(padding-right, 4rem);
|
||||||
@include nb-rtl(padding-left, 4rem);
|
@include nb-rtl(padding-left, 4rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown {
|
|
||||||
min-width: 120px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@
|
||||||
<nb-card size="small">
|
<nb-card size="small">
|
||||||
<ngx-traffic-cards-header [type]="period" (periodChange)="setPeriodAngGetData($event)"></ngx-traffic-cards-header>
|
<ngx-traffic-cards-header [type]="period" (periodChange)="setPeriodAngGetData($event)"></ngx-traffic-cards-header>
|
||||||
<ngx-traffic-front-card [frontCardData]="trafficListData"></ngx-traffic-front-card>
|
<ngx-traffic-front-card [frontCardData]="trafficListData"></ngx-traffic-front-card>
|
||||||
<i class="nb-arrow-up" (click)="toggleView()"></i>
|
<nb-icon class="toggle-icon" icon="chevron-up-outline" pack="eva" (click)="toggleView()"></nb-icon>
|
||||||
</nb-card>
|
</nb-card>
|
||||||
</nb-card-front>
|
</nb-card-front>
|
||||||
<nb-card-back>
|
<nb-card-back>
|
||||||
<nb-card size="small">
|
<nb-card size="small">
|
||||||
<ngx-traffic-cards-header [type]="period" (periodChange)="setPeriodAngGetData($event)"></ngx-traffic-cards-header>
|
<ngx-traffic-cards-header [type]="period" (periodChange)="setPeriodAngGetData($event)"></ngx-traffic-cards-header>
|
||||||
<ngx-traffic-back-card [trafficBarData]="trafficBarData"></ngx-traffic-back-card>
|
<ngx-traffic-back-card [trafficBarData]="trafficBarData"></ngx-traffic-back-card>
|
||||||
<i class="nb-arrow-down" (click)="toggleView()"></i>
|
<nb-icon class="toggle-icon" icon="chevron-down-outline" pack="eva" (click)="toggleView()"></nb-icon>
|
||||||
</nb-card>
|
</nb-card>
|
||||||
</nb-card-back>
|
</nb-card-back>
|
||||||
</nb-reveal-card>
|
</nb-reveal-card>
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,12 @@
|
||||||
@import '../../../@theme/styles/themes';
|
@import '../../../@theme/styles/themes';
|
||||||
|
|
||||||
@include nb-install-component() {
|
@include nb-install-component() {
|
||||||
.nb-arrow-up, .nb-arrow-down {
|
.toggle-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 1rem;
|
||||||
right: 0;
|
right: 1.25rem;
|
||||||
@include nb-rtl(right, auto);
|
@include nb-rtl(right, auto);
|
||||||
@include nb-rtl(left, 0);
|
@include nb-rtl(left, 1.25rem);
|
||||||
padding: 1.5rem;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
nb-card-back {
|
|
||||||
::ng-deep nb-card-header {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue