Skip to content

Commit 87b727a

Browse files
authored
Merge pull request #8 from ekkolon/add-playground-pages
Add playground pages
2 parents 075f6ab + 470564a commit 87b727a

35 files changed

+788
-24
lines changed

angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"projects/ngx-gist-playground/src/assets"
6464
],
6565
"styles": [
66-
"@angular/material/prebuilt-themes/pink-bluegrey.css",
66+
"@angular/material/prebuilt-themes/indigo-pink.css",
6767
"projects/ngx-gist-playground/src/styles.scss"
6868
],
6969
"scripts": []

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
"@angular/platform-browser": "^15.1.0",
2121
"@angular/platform-browser-dynamic": "^15.1.0",
2222
"@angular/router": "^15.1.0",
23+
"highlightjs-copy": "^1.0.3",
24+
"highlightjs-line-numbers.js": "^2.8.0",
2325
"iframe-resizer": "^4.3.3",
26+
"ngx-highlightjs": "^8.0.0",
2427
"rxjs": "~7.8.0",
2528
"tslib": "^2.3.0",
2629
"zone.js": "~0.12.0"
@@ -40,4 +43,4 @@
4043
"ng-packagr": "^15.1.0",
4144
"typescript": "~4.9.4"
4245
}
43-
}
46+
}

projects/ngx-gist-playground/src/app/app-routing.module.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<div class="ngx-gist-playground-wrapper">
2+
<nav id="nav">
3+
<mat-toolbar>
4+
<button mat-icon-button (click)="sidenav.toggle()">
5+
<mat-icon fontSet="material-symbols-outlined">menu</mat-icon>
6+
</button>
7+
<span class="title">NGX Gist Playground</span>
8+
9+
<div class="flex-fill"></div>
10+
11+
<div class="code-registry-list">
12+
<div class="code-registry-list__item">
13+
<a class="code-registry-link" [href]="GITHUB_REPO_URL" target="_blank">
14+
<img src="assets/logos/github-mark.svg" alt="">
15+
</a>
16+
</div>
17+
</div>
18+
</mat-toolbar>
19+
</nav>
20+
<mat-sidenav-container id="container">
21+
<mat-sidenav id="sidenav" #sidenav mode="side" opened="true" fixedInViewport>
22+
<mat-nav-list>
23+
<a *ngFor="let link of routerLinks" [routerLink]="link.path" mat-list-item>
24+
<mat-icon matListItemIcon fontSet="material-symbols-outlined">{{link.icon}}</mat-icon>
25+
<span matListItemTitle>{{link.title}}</span>
26+
</a>
27+
</mat-nav-list>
28+
</mat-sidenav>
29+
<mat-sidenav-content id="content">
30+
<router-outlet></router-outlet>
31+
</mat-sidenav-content>
32+
</mat-sidenav-container>
33+
</div>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
:host {
2+
display: block;
3+
width: 100%;
4+
height: 100%;
5+
}
6+
7+
.ngx-gist-playground-wrapper {
8+
display: flex;
9+
flex-direction: column;
10+
position: relative;
11+
}
12+
13+
.flex-fill {
14+
flex: 1 0 auto;
15+
}
16+
17+
#nav {
18+
height: var(--ngx-gist-playground-nav-height);
19+
background: var(--ngx-gist-playground-nav-background);
20+
color: var(--ngx-gist-playground-nav-color);
21+
position: fixed;
22+
top: 0;
23+
left: 0;
24+
right: 0;
25+
z-index: 1001;
26+
box-shadow: rgba(0, 0, 0, 0.02) 0px 1px 3px 0px, rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;
27+
}
28+
29+
#nav mat-toolbar {
30+
background-color: inherit;
31+
}
32+
33+
#nav .title {
34+
margin-left: 16px;
35+
font-size: 1.161rem;
36+
font-weight: 700;
37+
font-family: Poppins, sans-serif;
38+
letter-spacing: -0.0314rem;
39+
}
40+
41+
#nav .code-registry-list {
42+
display: flex;
43+
44+
.code-registry-list__item {
45+
display: flex;
46+
47+
.code-registry-link {
48+
img {
49+
height: 28px;
50+
}
51+
}
52+
}
53+
}
54+
55+
#container {
56+
height: 100%;
57+
}
58+
59+
#sidenav {
60+
top: var(--ngx-gist-playground-nav-height) !important;
61+
width: var(--ngx-gist-playground-sidenav-width) !important;
62+
color: var(--ngx-gist-playground-sidenav-color);
63+
background: var(--ngx-gist-playground-sidenav-background);
64+
border-right: var(--ngx-gist-playground-sidenav-border);
65+
}
66+
67+
#sidenav a[mat-list-item] {
68+
padding-left: 12px;
69+
}
70+
71+
#sidenav .mat-mdc-list-item .mdc-list-item__primary-text {
72+
font-family: Poppins, sans-serif;
73+
}
74+
75+
#content {
76+
padding-top: var(--ngx-gist-playground-nav-height);
77+
overflow: hidden;
78+
}

projects/ngx-gist-playground/src/app/app.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88

99
import {Component} from '@angular/core';
1010

11+
import {routerLinks} from './navigation/router-links';
12+
1113
@Component({
1214
selector: 'ngx-gist-playground-root',
1315
templateUrl: './app.component.html',
1416
styleUrls: ['./app.component.scss'],
1517
})
1618
export class AppComponent {
19+
GITHUB_REPO_URL = 'https://github.com/ekkolon/ngx-gist';
1720
title = 'ngx-gist-playground';
21+
22+
routerLinks = routerLinks;
1823
}

projects/ngx-gist-playground/src/app/app.module.ts

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,65 @@ import {NgModule} from '@angular/core';
1010
import {BrowserModule} from '@angular/platform-browser';
1111
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
1212

13+
import {MatButtonModule} from '@angular/material/button';
14+
import {MatIconModule} from '@angular/material/icon';
15+
import {MatListModule} from '@angular/material/list';
16+
import {MatSidenavModule} from '@angular/material/sidenav';
17+
import {MatToolbarModule} from '@angular/material/toolbar';
18+
19+
import {HighlightModule, HIGHLIGHT_OPTIONS} from 'ngx-highlightjs';
20+
1321
import {NgxGistModule} from '@ekkolon/ngx-gist';
1422

15-
import {AppRoutingModule} from './app-routing.module';
1623
import {AppComponent} from './app.component';
24+
import {ApiReferenceComponent} from './routes/api-reference/api-reference.component';
25+
import {AppRoutingModule} from './routes/app-routing.module';
26+
import {ExamplesComponent} from './routes/examples/examples.component';
27+
import {GettingStartedComponent} from './routes/getting-started/getting-started.component';
28+
import {HomeComponent} from './routes/home/home.component';
29+
import {SecurityComponent} from './routes/security/security.component';
30+
31+
const materialModules = [
32+
MatSidenavModule,
33+
MatToolbarModule,
34+
MatIconModule,
35+
MatListModule,
36+
MatButtonModule,
37+
];
1738

1839
@NgModule({
19-
declarations: [AppComponent],
20-
imports: [BrowserModule, BrowserAnimationsModule, NgxGistModule, AppRoutingModule],
21-
providers: [],
40+
declarations: [
41+
AppComponent,
42+
HomeComponent,
43+
GettingStartedComponent,
44+
ExamplesComponent,
45+
SecurityComponent,
46+
ApiReferenceComponent,
47+
],
48+
imports: [
49+
BrowserModule,
50+
BrowserAnimationsModule,
51+
NgxGistModule,
52+
AppRoutingModule,
53+
NgScrollbarModule,
54+
HighlightModule,
55+
...materialModules,
56+
],
57+
providers: [
58+
{
59+
provide: HIGHLIGHT_OPTIONS,
60+
useValue: {
61+
coreLibraryLoader: async () => import('highlight.js/lib/core'),
62+
lineNumbersLoader: () => import('highlightjs-line-numbers.js' as any), // Optional, only if you want the line numbers
63+
languages: {
64+
typescript: () => import('highlight.js/lib/languages/typescript'),
65+
shell: () => import('highlight.js/lib/languages/shell'),
66+
xml: () => import('highlight.js/lib/languages/xml'),
67+
},
68+
//themePath: 'path-to-theme.css', // Optional, and useful if you want to change the theme dynamically
69+
},
70+
},
71+
],
2272
bootstrap: [AppComponent],
2373
})
2474
export class AppModule {}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export interface RouterLink {
2+
path: string;
3+
title: string;
4+
icon: string;
5+
}
6+
7+
export const routerLinks: RouterLink[] = [
8+
{
9+
path: '/',
10+
title: 'Home',
11+
icon: 'home',
12+
},
13+
{
14+
path: '/getting-started',
15+
title: 'Getting Started',
16+
icon: 'rocket_launch',
17+
},
18+
{
19+
path: '/examples',
20+
title: 'Examples',
21+
icon: 'view_cozy',
22+
},
23+
{
24+
path: 'security',
25+
title: 'Security',
26+
icon: 'security',
27+
},
28+
{
29+
path: 'api-reference',
30+
title: 'API Reference',
31+
icon: 'api',
32+
},
33+
];
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="ngx-gist-playground-page">
2+
<div class="ngx-gist-playground-page__header">
3+
<h1 class="ngx-gist-playground-page__title">API Reference</h1>
4+
</div>
5+
<div class="ngx-gist-playground-page__content"></div>
6+
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:host {
2+
display: block;
3+
}

0 commit comments

Comments
 (0)