mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
fix(docs): popover and themes page
This commit is contained in:
parent
7a1c74cb18
commit
413cbdbd01
9 changed files with 39 additions and 22 deletions
|
|
@ -1,12 +1,16 @@
|
||||||
|
<div style="position: relative;">
|
||||||
|
<nb-badge text="New!" status="danger" position="top right"></nb-badge>
|
||||||
<a
|
<a
|
||||||
routerLink="/material"
|
routerLink="/material"
|
||||||
class="eva-parent-hover"
|
class="eva-parent-hover"
|
||||||
[nbPopover]="popoverContent"
|
[nbPopover]="popoverContent"
|
||||||
nbPopoverPlacement="bottom"
|
nbPopoverPlacement="bottom"
|
||||||
nbPopoverTrigger="noop"
|
nbPopoverTrigger="noop"
|
||||||
|
nbPopoverOffset="0"
|
||||||
>
|
>
|
||||||
Material Theme
|
Material Theme
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ng-template #popoverContent>
|
<ng-template #popoverContent>
|
||||||
<p class="material-theme-popover" (mouseover)="hidePopover()">New theme is available!</p>
|
<p class="material-theme-popover" (mouseover)="hidePopover()">New theme is available!</p>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
@include nb-install-component() {
|
@include nb-install-component() {
|
||||||
$menu-item-fg: nb-theme(color-fg-heading-light);
|
$menu-item-fg: nb-theme(color-fg-heading-light);
|
||||||
$menu-item-fg-active: nb-theme(header-menu-fg-active);
|
$menu-item-fg-active: nb-theme(header-menu-fg-active);
|
||||||
$header-font-weight: nb-theme(header-font-weight);
|
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -15,7 +14,7 @@
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: $header-font-weight;
|
font-weight: 600;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
padding: 0.675rem 1.375rem;
|
padding: 0.675rem 1.375rem;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import {NbPopoverModule} from '@nebular/theme';
|
import {NbBadgeModule, NbPopoverModule} from '@nebular/theme';
|
||||||
import { MaterialThemeLinkComponent } from './components/material-theme-link/material-theme-link.component';
|
import { MaterialThemeLinkComponent } from './components/material-theme-link/material-theme-link.component';
|
||||||
import { CapitalizePipe } from './pipes/capitalize.pipe';
|
import { CapitalizePipe } from './pipes/capitalize.pipe';
|
||||||
import { EvaIconsPipe } from './pipes/eva-icons.pipe';
|
import { EvaIconsPipe } from './pipes/eva-icons.pipe';
|
||||||
|
|
@ -9,7 +9,7 @@ const component = [MaterialThemeLinkComponent];
|
||||||
const pipes = [CapitalizePipe, EvaIconsPipe];
|
const pipes = [CapitalizePipe, EvaIconsPipe];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule, NbPopoverModule],
|
imports: [RouterModule, NbPopoverModule, NbBadgeModule],
|
||||||
declarations: [...component, ...pipes],
|
declarations: [...component, ...pipes],
|
||||||
exports: [NbPopoverModule, ...component, ...pipes],
|
exports: [NbPopoverModule, ...component, ...pipes],
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ export class CurrentThemeService implements OnDestroy {
|
||||||
localStorage.setItem('theme', JSON.stringify(currentTheme));
|
localStorage.setItem('theme', JSON.stringify(currentTheme));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCurrentTheme(): string {
|
||||||
|
return JSON.parse(localStorage.theme).themeName;
|
||||||
|
}
|
||||||
|
|
||||||
calculateExpiration(iat: number): number {
|
calculateExpiration(iat: number): number {
|
||||||
const currentDate = new Date().getTime();
|
const currentDate = new Date().getTime();
|
||||||
const timestamp = iat || Math.floor(Date.now() / 1000);
|
const timestamp = iat || Math.floor(Date.now() / 1000);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {CurrentThemeService} from '../../../@core/utils/theme.service';
|
||||||
export class HeaderComponent implements OnInit, OnDestroy {
|
export class HeaderComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private destroy$: Subject<void> = new Subject<void>();
|
private destroy$: Subject<void> = new Subject<void>();
|
||||||
public readonly materialTheme$: Observable<boolean>;
|
public materialTheme$: Observable<boolean>;
|
||||||
userPictureOnly: boolean = false;
|
userPictureOnly: boolean = false;
|
||||||
user: any;
|
user: any;
|
||||||
|
|
||||||
|
|
@ -62,14 +62,15 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
||||||
private analytics: AnalyticsService,
|
private analytics: AnalyticsService,
|
||||||
private currentThemeService: CurrentThemeService,
|
private currentThemeService: CurrentThemeService,
|
||||||
) {
|
) {
|
||||||
this.materialTheme$ = this.themeService.onThemeChange()
|
|
||||||
.pipe(map(theme => {
|
|
||||||
const themeName: string = theme?.name || '';
|
|
||||||
return themeName.startsWith('material');
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.materialTheme$ = new Observable(subscriber => {
|
||||||
|
const themeName: string = this.currentThemeService.getCurrentTheme();
|
||||||
|
|
||||||
|
subscriber.next(themeName.startsWith('material'));
|
||||||
|
});
|
||||||
|
|
||||||
this.currentTheme = this.themeService.currentTheme;
|
this.currentTheme = this.themeService.currentTheme;
|
||||||
|
|
||||||
this.userService.getUsers()
|
this.userService.getUsers()
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { SeoService } from './@core/utils/seo.service';
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
|
|
||||||
themes = ['default', 'cosmic', 'corporate', 'dark'];
|
themes = ['default', 'cosmic', 'corporate', 'dark', 'material-dark', 'material-light'];
|
||||||
|
|
||||||
constructor(private analytics: AnalyticsService,
|
constructor(private analytics: AnalyticsService,
|
||||||
private seoService: SeoService,
|
private seoService: SeoService,
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
<nb-layout-header fixed>
|
<nb-layout-header fixed>
|
||||||
<div class="header-container">
|
<div class="header-container">
|
||||||
<div class="logo-container">
|
<div class="logo-container">
|
||||||
<p class="logo">ngx-<span>admin</span></p>
|
<p [ngClass]="{ 'material-text-color': (materialTheme$ | async) }" class="logo">ngx-<span>admin</span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="header-container">
|
<div class="header-container">
|
||||||
<nb-actions size="small">
|
<nb-actions size="small">
|
||||||
<nb-action class="control-item github-stars">
|
<nb-action class="control-item github-stars">
|
||||||
<span class="subtitle text">Support us: </span>
|
<span [ngClass]="{ 'material-text-color': (materialTheme$ | async) }" class="subtitle text">Support us: </span>
|
||||||
<iframe src="https://ghbtns.com/github-btn.html?user=akveo&repo=ngx-admin&type=star&count=true"
|
<iframe src="https://ghbtns.com/github-btn.html?user=akveo&repo=ngx-admin&type=star&count=true"
|
||||||
frameborder="0"
|
frameborder="0"
|
||||||
scrolling="0"
|
scrolling="0"
|
||||||
|
|
@ -19,12 +19,12 @@
|
||||||
</nb-action>
|
</nb-action>
|
||||||
<nb-action class="control-item downloads-count">
|
<nb-action class="control-item downloads-count">
|
||||||
<nb-icon icon="download"></nb-icon>
|
<nb-icon icon="download"></nb-icon>
|
||||||
<span class="subtitle number">470.000</span>
|
<span [ngClass]="{ 'material-text-color': (materialTheme$ | async) }" class="subtitle number">470.000</span>
|
||||||
</nb-action>
|
</nb-action>
|
||||||
<nb-action class="control-item contact-us" (click)="trackEmailClick()">
|
<nb-action class="control-item contact-us" (click)="trackEmailClick()">
|
||||||
<a nbButton ghost href="mailto:contact@akveo.com">
|
<a nbButton ghost href="mailto:contact@akveo.com">
|
||||||
<nb-icon icon="email-outline" pack="eva"></nb-icon>
|
<nb-icon icon="email-outline" pack="eva"></nb-icon>
|
||||||
<span>contact@akveo.com</span>
|
<span [ngClass]="{ 'material-text-color': (materialTheme$ | async) }">contact@akveo.com</span>
|
||||||
</a>
|
</a>
|
||||||
</nb-action>
|
</nb-action>
|
||||||
</nb-actions>
|
</nb-actions>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,10 @@
|
||||||
@import '../@theme/styles/themes';
|
@import '../@theme/styles/themes';
|
||||||
|
|
||||||
@include nb-install-component() {
|
@include nb-install-component() {
|
||||||
|
.material-text-color {
|
||||||
|
color: nb-theme(color-basic-100);
|
||||||
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import {Component, OnDestroy} from '@angular/core';
|
import {Component, OnDestroy} from '@angular/core';
|
||||||
import {NbMediaBreakpoint, NbThemeService} from '@nebular/theme';
|
import {NbMediaBreakpoint} from '@nebular/theme';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {AnalyticsService} from '../@core/utils';
|
import {AnalyticsService} from '../@core/utils';
|
||||||
import {CurrentThemeService} from '../@core/utils/theme.service';
|
import {CurrentThemeService} from '../@core/utils/theme.service';
|
||||||
|
import {Observable} from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ngx-starter',
|
selector: 'ngx-starter',
|
||||||
|
|
@ -13,22 +14,28 @@ export class NgxStarterComponent implements OnDestroy {
|
||||||
breakpoint: NbMediaBreakpoint;
|
breakpoint: NbMediaBreakpoint;
|
||||||
breakpoints: any;
|
breakpoints: any;
|
||||||
|
|
||||||
|
public readonly materialTheme$ = new Observable(subscriber => {
|
||||||
|
const themeName: string = this.currentThemeService.getCurrentTheme();
|
||||||
|
|
||||||
|
subscriber.next(themeName.startsWith('material'));
|
||||||
|
});
|
||||||
|
|
||||||
themes = [
|
themes = [
|
||||||
{
|
{
|
||||||
value: 'material-light',
|
value: 'material-light',
|
||||||
name: 'Material Light',
|
name: 'Material Light',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'dark',
|
value: 'material-dark',
|
||||||
name: 'Dark',
|
name: 'Material Dark',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'default',
|
value: 'default',
|
||||||
name: 'Light',
|
name: 'Light',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'material-dark',
|
value: 'dark',
|
||||||
name: 'Material Dark',
|
name: 'Dark',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'corporate',
|
value: 'corporate',
|
||||||
|
|
@ -41,14 +48,12 @@ export class NgxStarterComponent implements OnDestroy {
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(private router: Router,
|
constructor(private router: Router,
|
||||||
private themeService: NbThemeService,
|
|
||||||
private currentThemeService: CurrentThemeService,
|
private currentThemeService: CurrentThemeService,
|
||||||
private analytics: AnalyticsService,
|
private analytics: AnalyticsService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
navigate(themeName: string) {
|
navigate(themeName: string) {
|
||||||
this.currentThemeService.setCurrentTheme(themeName);
|
this.currentThemeService.setCurrentTheme(themeName);
|
||||||
this.themeService.changeTheme(themeName);
|
|
||||||
this.router.navigate(['/pages/dashboard'], {queryParams: {theme: themeName}});
|
this.router.navigate(['/pages/dashboard'], {queryParams: {theme: themeName}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue