mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-28 13:18:49 +01:00
feat: docs app
This commit is contained in:
parent
713aff561e
commit
2129689f98
203 changed files with 15927 additions and 5 deletions
|
|
@ -0,0 +1,32 @@
|
|||
<div class="middle-column">
|
||||
|
||||
<nb-card *ngIf="currentItem?.tabs" class="horizontal-nav">
|
||||
<nb-card-header>
|
||||
{{ currentItem?.name }}
|
||||
</nb-card-header>
|
||||
<nb-card-body>
|
||||
<ngx-page-tabs [tabs]="currentItem?.tabs" horizontal></ngx-page-tabs>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
|
||||
<ng-container *ngFor="let block of currentItem?.children">
|
||||
<ng-container [ngSwitch]="block.block">
|
||||
<ngx-md-block *ngSwitchCase="'markdown'" [source]="block.children"></ngx-md-block>
|
||||
<ngx-component-block *ngSwitchCase="'component'" [source]="block.source"></ngx-component-block>
|
||||
<ngx-tabbed-block *ngSwitchCase="'tabbed'" [source]="block.children" [tabs]="currentItem.tabs"></ngx-tabbed-block>
|
||||
<ngx-theme-block *ngSwitchCase="'theme'" [block]="block"></ngx-theme-block>
|
||||
<ngx-components-overview-block *ngSwitchCase="'components-overview'"></ngx-components-overview-block>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
<p class="not-found" *ngIf="!currentItem">Page does not exist.</p>
|
||||
|
||||
<ngx-pager-block [currentItemSlag]="currentItem?.slag"></ngx-pager-block>
|
||||
</div>
|
||||
|
||||
<div class="settings-column" *ngIf="showSettings">
|
||||
<div class="fixed-panel">
|
||||
<ngx-page-tabs [tabs]="currentItem?.tabs"></ngx-page-tabs>
|
||||
<ngx-page-toc [toc]="currentItem?.toc"></ngx-page-toc>
|
||||
</div>
|
||||
</div>
|
||||
243
docs/app/pages/docs/page/ngx-admin-landing-page.component.scss
Normal file
243
docs/app/pages/docs/page/ngx-admin-landing-page.component.scss
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Akveo. All Rights Reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*/
|
||||
|
||||
@import '../../../@theme/styles/themes';
|
||||
|
||||
@include nb-install-component() {
|
||||
display: flex;
|
||||
|
||||
$note-fg-info: nb-theme(color-info);
|
||||
$note-bg-info: #f0f6ff;
|
||||
$note-fg-warning: nb-theme(color-warning);
|
||||
$note-bg-warning: #fffae4;
|
||||
$settings-width: nb-theme(settings-col-width);
|
||||
$settings-margin: nb-theme(settings-col-margin);
|
||||
$heading-light: nb-theme(color-fg-heading-light);
|
||||
$code-bg: #f1f2f3;
|
||||
$code-fg: nb-theme(color-info);
|
||||
$code-block-bg: nb-theme(code-block-bg);
|
||||
$table-head-fg: #8994a3;
|
||||
$table-border: 1px solid #f1f2f3;
|
||||
$table-stripe-bg: #f5f6f7;
|
||||
|
||||
.not-found {
|
||||
color: $heading-light;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.middle-column {
|
||||
flex: 3;
|
||||
min-width: 0;
|
||||
|
||||
::ng-deep nb-card {
|
||||
|
||||
nb-card-body {
|
||||
padding: 2rem 1rem;
|
||||
|
||||
> *:last-child {
|
||||
margin-bottom: 0!important;
|
||||
|
||||
*:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
line-height: 1.25;
|
||||
margin-bottom: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: $heading-light;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
code {
|
||||
background: $code-bg;
|
||||
color: $code-fg;
|
||||
padding: 0.125rem 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
code.hljs {
|
||||
color: #f8f8f2;
|
||||
padding: 2rem 2.5rem;
|
||||
border-radius: 0.5rem;
|
||||
background: $code-block-bg;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
::ng-deep {
|
||||
.widget-block {
|
||||
display: block;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
ngx-styles-table-block table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 0.9375rem;
|
||||
width: 100%;
|
||||
margin-bottom: 3rem;
|
||||
thead {
|
||||
color: $table-head-fg;
|
||||
border-bottom: $table-border;
|
||||
|
||||
td {
|
||||
padding: 1rem 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
tr {
|
||||
border-bottom: $table-border;
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 1rem 0.5rem;
|
||||
|
||||
&:first-child {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
&.striped {
|
||||
tbody tr:nth-child(odd) {
|
||||
background: $table-stripe-bg;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 1rem 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-bottom: 1.5rem;
|
||||
ul {
|
||||
padding-left: 2.5rem;
|
||||
list-style-type: none;
|
||||
& > li {
|
||||
list-style: circle;
|
||||
position: relative;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
li {
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.note {
|
||||
padding: 1.25rem 3rem 1.5rem 1.25rem;
|
||||
border-radius: 0.25rem;
|
||||
margin-bottom: 3rem;
|
||||
|
||||
.note-title {
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.note-body {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
&.note-info {
|
||||
color: $note-fg-info;
|
||||
background-color: $note-bg-info;
|
||||
}
|
||||
|
||||
&.note-warning {
|
||||
color: $note-fg-warning;
|
||||
background-color: $note-bg-warning;
|
||||
}
|
||||
}
|
||||
|
||||
.color-swatch {
|
||||
display: inline-block;
|
||||
border: 1px solid black;
|
||||
width: 0.875rem;
|
||||
height: 0.875rem;
|
||||
margin-left: 7px;
|
||||
margin-bottom: -2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.horizontal-nav {
|
||||
margin-top: 1rem;
|
||||
|
||||
nb-card-body {
|
||||
background-color: nb-theme(layout-bg);
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
.settings-column {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@include media-breakpoint-up(md) {
|
||||
.middle-column ::ng-deep nb-card nb-card-body {
|
||||
padding: 2rem 3rem 2rem 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
@include media-breakpoint-up(lg) {
|
||||
.horizontal-nav {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@include media-breakpoint-up(macpro) {
|
||||
.horizontal-nav nb-card-body {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.settings-column {
|
||||
display: block;
|
||||
margin-left: $settings-margin;
|
||||
width: $settings-width;
|
||||
|
||||
ngx-page-tabs {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.fixed-panel {
|
||||
position: fixed;
|
||||
width: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
103
docs/app/pages/docs/page/ngx-admin-landing-page.component.ts
Normal file
103
docs/app/pages/docs/page/ngx-admin-landing-page.component.ts
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Akveo. All Rights Reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*/
|
||||
|
||||
import { Component, Inject, NgZone, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import {
|
||||
filter,
|
||||
map,
|
||||
publishBehavior,
|
||||
publishReplay,
|
||||
refCount,
|
||||
tap,
|
||||
takeWhile,
|
||||
} from 'rxjs/operators';
|
||||
import { NB_WINDOW } from '@nebular/theme';
|
||||
import { fromEvent } from 'rxjs';
|
||||
|
||||
import { NgxStructureService } from '../../../@theme/services/structure.service';
|
||||
import { NgxTocStateService } from '../../../@theme/services/toc-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-admin-landing-page',
|
||||
templateUrl: './ngx-admin-landing-page.component.html',
|
||||
styleUrls: ['./ngx-admin-landing-page.component.scss'],
|
||||
})
|
||||
export class NgxAdminLandingPageComponent implements OnDestroy, OnInit {
|
||||
|
||||
currentItem;
|
||||
private alive = true;
|
||||
|
||||
constructor(@Inject(NB_WINDOW) private window,
|
||||
private ngZone: NgZone,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private structureService: NgxStructureService,
|
||||
private tocState: NgxTocStateService,
|
||||
private titleService: Title) {
|
||||
}
|
||||
|
||||
get showSettings() {
|
||||
return this.currentItem && this.currentItem.children
|
||||
.some((item) => ['markdown', 'component', 'tabbed'].includes(item.block));
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.handlePageNavigation();
|
||||
this.handleTocScroll();
|
||||
this.window.history.scrollRestoration = 'manual';
|
||||
}
|
||||
|
||||
handlePageNavigation() {
|
||||
this.activatedRoute.params
|
||||
.pipe(
|
||||
takeWhile(() => this.alive),
|
||||
filter((params: any) => params.subPage),
|
||||
map((params: any) => {
|
||||
const slag = `${params.page}_${params.subPage}`;
|
||||
return this.structureService.findPageBySlag(this.structureService.getPreparedStructure(), slag);
|
||||
}),
|
||||
filter(item => item),
|
||||
tap((item: any) => {
|
||||
this.titleService.setTitle(`Nebular - ${item.name}`);
|
||||
}),
|
||||
publishReplay(),
|
||||
refCount(),
|
||||
)
|
||||
.subscribe((item) => {
|
||||
this.currentItem = item;
|
||||
});
|
||||
}
|
||||
|
||||
handleTocScroll() {
|
||||
this.ngZone.runOutsideAngular(() => {
|
||||
fromEvent(this.window, 'scroll')
|
||||
.pipe(
|
||||
publishBehavior(null),
|
||||
refCount(),
|
||||
takeWhile(() => this.alive),
|
||||
filter(() => this.tocState.list().length > 0),
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.tocState.list().map(item => item.setInView(false));
|
||||
|
||||
const current: any = this.tocState.list().reduce((acc, item) => {
|
||||
return item.y > 0 && item.y < acc.y ? item : acc;
|
||||
}, { y: Number.POSITIVE_INFINITY, fake: true });
|
||||
|
||||
if (current && !current.fake) {
|
||||
current.setInView(true);
|
||||
this.router.navigate([], { fragment: current.fragment, replaceUrl: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.alive = false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue