Skip to content

Commit f994b25

Browse files
committed
feat(docs): Added a first skeleton of a proper bootstrap demo app
1 parent 4e970ba commit f994b25

12 files changed

Lines changed: 167 additions & 33 deletions

File tree

angular.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"projects/ngqp-demo/src/assets"
5959
],
6060
"styles": [
61-
"projects/ngqp-demo/src/styles.css"
61+
"projects/ngqp-demo/src/styles.css",
62+
"node_modules/bootstrap/dist/css/bootstrap.min.css"
6263
],
6364
"scripts": []
6465
},

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
"@angular/platform-browser": "~7.1.0",
2424
"@angular/platform-browser-dynamic": "~7.1.0",
2525
"@angular/router": "~7.1.0",
26+
"@ng-bootstrap/ng-bootstrap": "^4.0.0",
2627
"@ngqp/core": "./projects/ngqp/core",
28+
"bootstrap": "^4.1.3",
2729
"core-js": "^2.5.4",
2830
"rxjs": "~6.3.3",
2931
"tslib": "^1.9.0",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
import { PlaygroundComponent } from './playground/playground.component';
4+
5+
const routes: Routes = [
6+
{
7+
path: 'playground',
8+
component: PlaygroundComponent,
9+
},
10+
{
11+
path: '**',
12+
redirectTo: '/playground',
13+
},
14+
];
15+
16+
@NgModule({
17+
imports: [
18+
RouterModule.forRoot(routes),
19+
],
20+
exports: [ RouterModule ],
21+
})
22+
export class AppRoutingModule {
23+
}
Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
<div [queryParamGroup]="paramGroup">
2-
<input type="text" placeholder="Search" queryParamName="search" />
3-
<button type="button" routerLink="./" [queryParams]="{q: 'foo'}" queryParamsHandling="merge">Go to ?q=foo</button>
1+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
2+
<img src="assets/logo.svg" height="48" width="auto" />
3+
<a class="navbar-brand" routerLink="/">@ngqp</a>
4+
<button class="navbar-toggler" type="button" (click)="isNavbarExpanded = !isNavbarExpanded">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
47

5-
<br />
8+
<div class="navbar-collapse" [class.collapse]="!isNavbarExpanded">
9+
<ul class="navbar-nav mr-auto">
10+
<li class="nav-item active">
11+
<a class="nav-link" href="/playground">Playground</a>
12+
</li>
13+
</ul>
14+
</div>
15+
</nav>
616

7-
<select queryParamName="type">
8-
<option [value]="1">Dog</option>
9-
<option [value]="2">Cat</option>
10-
<option [value]="3">Mouse</option>
11-
</select>
12-
</div>
17+
<div class="alert alert-danger" role="alert">
18+
@ngqp is still under early development. This website currently serves only as a playground.
19+
</div>
20+
21+
<main role="main" class="container mt-5">
22+
<router-outlet></router-outlet>
23+
</main>
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
import { Component } from '@angular/core';
2-
import { QueryParamBuilder, QueryParamGroup } from '@ngqp/core';
32

43
@Component({
54
selector: 'app-root',
65
templateUrl: './app.component.html',
76
})
87
export class AppComponent {
98

10-
public paramGroup: QueryParamGroup;
11-
12-
constructor(private queryParamBuilder: QueryParamBuilder) {
13-
this.paramGroup = queryParamBuilder.group({
14-
search: queryParamBuilder.param({
15-
name: 'q',
16-
}),
17-
type: queryParamBuilder.param({
18-
serialize: (value: number | null) => value === null ? null : `V${value}`,
19-
deserialize: (value: string | null) => value ? +value[1] : 1,
20-
}),
21-
});
22-
}
9+
public isNavbarExpanded = false;
2310

2411
}

projects/ngqp-demo/src/app/app.module.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
import { BrowserModule } from '@angular/platform-browser';
21
import { NgModule } from '@angular/core';
3-
import { AppComponent } from './app.component';
4-
import { QueryParamModule } from '@ngqp/core';
5-
import { RouterModule } from '@angular/router';
2+
import { BrowserModule } from '@angular/platform-browser';
63
import { FormsModule } from '@angular/forms';
4+
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
5+
import { QueryParamModule } from '@ngqp/core';
6+
import { AppRoutingModule } from './app-routing.module';
7+
import { AppComponent } from './app.component';
8+
import { PlaygroundComponent } from './playground/playground.component';
79

810
@NgModule({
911
declarations: [
10-
AppComponent
12+
AppComponent,
13+
PlaygroundComponent
1114
],
1215
imports: [
1316
BrowserModule,
1417
FormsModule,
15-
RouterModule.forRoot([]),
18+
AppRoutingModule,
19+
NgbModule,
1620
QueryParamModule
1721
],
1822
providers: [],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<ng-container [queryParamGroup]="paramGroup">
2+
<input type="text" class="form-control" placeholder="Search" queryParamName="searchText" />
3+
</ng-container>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Component } from '@angular/core';
2+
import { QueryParamBuilder, QueryParamGroup } from '@ngqp/core';
3+
4+
@Component({
5+
templateUrl: './playground.component.html',
6+
})
7+
export class PlaygroundComponent {
8+
9+
public paramGroup: QueryParamGroup;
10+
11+
constructor(private queryParamBuilder: QueryParamBuilder) {
12+
this.paramGroup = queryParamBuilder.group({
13+
searchText: queryParamBuilder.param({
14+
name: 'q'
15+
}),
16+
});
17+
}
18+
19+
}
Lines changed: 73 additions & 0 deletions
Loading

projects/ngqp-demo/src/favicon.ico

5.45 KB
Binary file not shown.

0 commit comments

Comments
 (0)