+
+
+
+ Top content
+
+
+ Middle content
+
+
+ Bottom content
+
+
+
+
+ Top content
+
+
+ Middle content
+
+
+ Bottom content
+
+
+
+
diff --git a/showcase/src/app/app.component.spec.ts b/showcase/src/app/app.component.spec.ts
index 4701a2d29e..7556cb0726 100644
--- a/showcase/src/app/app.component.spec.ts
+++ b/showcase/src/app/app.component.spec.ts
@@ -2,14 +2,15 @@
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { async, TestBed, ComponentFixture } from "@angular/core/testing";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
+import { StarkAppSidebarService } from "@nationalbankbelgium/stark-ui";
/**
* Load the implementations that should be tested
*/
import { AppComponent } from "./app.component";
import { AppState } from "./app.service";
-import { STARK_LOGGING_SERVICE } from "@nationalbankbelgium/stark-core";
-import { MockStarkLoggingService } from "@nationalbankbelgium/stark-core/testing";
+import { STARK_LOGGING_SERVICE, STARK_ROUTING_SERVICE } from "@nationalbankbelgium/stark-core";
+import { MockStarkLoggingService, MockStarkRoutingService } from "@nationalbankbelgium/stark-core/testing";
import Spy = jasmine.Spy;
describe(`App`, () => {
@@ -25,7 +26,13 @@ describe(`App`, () => {
declarations: [AppComponent],
imports: [TranslateModule.forRoot()],
schemas: [NO_ERRORS_SCHEMA],
- providers: [{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() }, AppState, TranslateService]
+ providers: [
+ { provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() },
+ { provide: STARK_ROUTING_SERVICE, useClass: MockStarkRoutingService },
+ AppState,
+ StarkAppSidebarService,
+ TranslateService
+ ]
})
/**
* Compile template and css
diff --git a/showcase/src/app/app.component.ts b/showcase/src/app/app.component.ts
index 8736b37a21..2ca3d9e4f4 100644
--- a/showcase/src/app/app.component.ts
+++ b/showcase/src/app/app.component.ts
@@ -1,9 +1,10 @@
/**
* Angular 2 decorators and services
*/
-import { Component, Inject, OnInit, ViewEncapsulation } from "@angular/core";
+import { Component, Inject, OnInit, ViewChild, ViewEncapsulation } from "@angular/core";
+import { STARK_LOGGING_SERVICE, STARK_ROUTING_SERVICE, StarkLoggingService, StarkRoutingService } from "@nationalbankbelgium/stark-core";
+import { StarkAppSidebarComponent, StarkAppSidebarService } from "@nationalbankbelgium/stark-ui";
import { AppState } from "./app.service";
-import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core";
/**
* App Component
@@ -19,12 +20,35 @@ import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium
export class AppComponent implements OnInit {
public appState: AppState;
- public constructor(appState: AppState, @Inject(STARK_LOGGING_SERVICE) public logger: StarkLoggingService) {
+ @ViewChild("appSideBar")
+ public appSidebar: StarkAppSidebarComponent;
+
+ public constructor(
+ appState: AppState,
+ public sidebarService: StarkAppSidebarService,
+ @Inject(STARK_LOGGING_SERVICE) public logger: StarkLoggingService,
+ @Inject(STARK_ROUTING_SERVICE) public routingService: StarkRoutingService
+ ) {
this.appState = appState;
}
public ngOnInit(): void {
this.logger.debug("Initial App State", this.appState.state);
+ this.routingService.addTransitionHook("ON_SUCCESS", {}, () => {
+ this.sidebarService.close();
+ });
+ }
+
+ public openMenu(): void {
+ this.sidebarService.openMenu();
+ }
+
+ public openLeftSidebar(): void {
+ this.sidebarService.openLeft();
+ }
+
+ public openRightSidebar(): void {
+ this.sidebarService.openRight();
}
}
diff --git a/showcase/src/app/app.module.ts b/showcase/src/app/app.module.ts
index 1055583fd5..0931002c44 100644
--- a/showcase/src/app/app.module.ts
+++ b/showcase/src/app/app.module.ts
@@ -41,9 +41,11 @@ import {
import {
StarkAppLogoModule,
StarkAppLogoutModule,
+ StarkAppSidebarModule,
+ StarkAppSidebarService,
+ StarkBreadcrumbModule,
StarkSvgViewBoxModule,
- StarkDatePickerModule,
- StarkBreadcrumbModule
+ StarkDatePickerModule
} from "@nationalbankbelgium/stark-ui";
import { routerConfigFn } from "./router.config";
import { registerMaterialIconSet } from "./material-icons.config";
@@ -177,6 +179,7 @@ export const metaReducers: MetaReducer
[] = ENV !== "production" ? [logger
NewsModule,
StarkAppLogoModule,
StarkAppLogoutModule,
+ StarkAppSidebarModule,
StarkSvgViewBoxModule,
StarkDatePickerModule,
StarkBreadcrumbModule
@@ -187,6 +190,7 @@ export const metaReducers: MetaReducer[] = ENV !== "production" ? [logger
providers: [
environment.ENV_PROVIDERS,
APP_PROVIDERS,
+ StarkAppSidebarService,
{ provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader }, // needed for ui-router
{ provide: STARK_APP_CONFIG, useFactory: starkAppConfigFactory },
{ provide: STARK_APP_METADATA, useFactory: starkAppMetadataFactory },
diff --git a/showcase/src/app/app.routes.ts b/showcase/src/app/app.routes.ts
index 97738b2501..5ce78c2d7f 100644
--- a/showcase/src/app/app.routes.ts
+++ b/showcase/src/app/app.routes.ts
@@ -4,6 +4,7 @@ import {
ButtonComponent,
DatePickerComponent,
DateRangePickerComponent,
+ DemoSidebarComponent,
DropdownComponent,
ExampleViewerComponent,
HeaderComponent,
@@ -30,6 +31,7 @@ export const APP_STATES: Ng2StateDeclaration[] = [
{ name: "demo-keyboard-directives", url: "/demo/keyboard-directives", component: KeyboardDirectivesComponent },
{ name: "demo-logout", url: "/demo/logout", component: LogoutComponent },
{ name: "demo-pretty-print", url: "/demo/pretty-print", component: PrettyPrintComponent },
+ { name: "demo-sidebar", url: "/demo/sidebar", component: DemoSidebarComponent },
{ name: "demo-table", url: "/demo/table", component: TableComponent },
{ name: "demo-dropdown", url: "/demo/dropdown", component: DropdownComponent },
{ name: "otherwise", url: "/otherwise", component: NoContentComponent }
diff --git a/showcase/src/app/demo/demo.module.ts b/showcase/src/app/demo/demo.module.ts
index 527e4465db..a6d377ddd2 100644
--- a/showcase/src/app/demo/demo.module.ts
+++ b/showcase/src/app/demo/demo.module.ts
@@ -18,6 +18,7 @@ import { DemoBreadcrumbComponent } from "./breadcrumb/breadcrumb.component";
import { ButtonComponent } from "./button/button.component";
import { DatePickerComponent } from "./date-picker/date-picker.component";
import { DateRangePickerComponent } from "./date-range-picker/date-range-picker.component";
+import { DemoSidebarComponent } from "./sidebar/demo-sidebar.component";
import { DropdownComponent } from "./dropdown/dropdown.component";
import { LogoutComponent } from "./logout/logout.component";
import { ExampleViewerComponent } from "./example-viewer/example-viewer.component";
@@ -81,6 +82,7 @@ import { MAT_DATE_FORMATS } from "@angular/material/core";
PrettyPrintComponent,
DatePickerComponent,
DateRangePickerComponent,
+ DemoSidebarComponent,
ExampleViewerComponent,
KeyboardDirectivesComponent,
TableComponent
diff --git a/showcase/src/app/demo/index.ts b/showcase/src/app/demo/index.ts
index 65826b8955..7760bf9827 100644
--- a/showcase/src/app/demo/index.ts
+++ b/showcase/src/app/demo/index.ts
@@ -3,6 +3,7 @@ export * from "./breadcrumb";
export * from "./button";
export * from "./date-picker";
export * from "./date-range-picker";
+export * from "./sidebar";
export * from "./dropdown";
export * from "./example-viewer";
export * from "./header";
diff --git a/showcase/src/app/demo/sidebar/demo-sidebar.component.html b/showcase/src/app/demo/sidebar/demo-sidebar.component.html
new file mode 100644
index 0000000000..e0b1bed0d3
--- /dev/null
+++ b/showcase/src/app/demo/sidebar/demo-sidebar.component.html
@@ -0,0 +1,3 @@
+
+ SHOWCASE.DEMO.SIDEBAR.INTRO
+
diff --git a/showcase/src/app/demo/sidebar/demo-sidebar.component.ts b/showcase/src/app/demo/sidebar/demo-sidebar.component.ts
new file mode 100644
index 0000000000..6618a7ab2c
--- /dev/null
+++ b/showcase/src/app/demo/sidebar/demo-sidebar.component.ts
@@ -0,0 +1,7 @@
+import { Component } from "@angular/core";
+
+@Component({
+ selector: "showcase-demo-sidebar",
+ templateUrl: "./demo-sidebar.component.html"
+})
+export class DemoSidebarComponent {}
diff --git a/showcase/src/app/demo/sidebar/index.ts b/showcase/src/app/demo/sidebar/index.ts
new file mode 100644
index 0000000000..5935dd3572
--- /dev/null
+++ b/showcase/src/app/demo/sidebar/index.ts
@@ -0,0 +1 @@
+export * from "./demo-sidebar.component";
diff --git a/showcase/src/assets/examples/sidebar/regular.html b/showcase/src/assets/examples/sidebar/regular.html
new file mode 100644
index 0000000000..532f987835
--- /dev/null
+++ b/showcase/src/assets/examples/sidebar/regular.html
@@ -0,0 +1,30 @@
+
+
+ ...
+
+
+
+ Top content
+
+
+ Middle content
+
+
+ Bottom content
+
+
+
+
+ Top content
+
+
+ Middle content
+
+
+ Bottom content
+
+
+
+ ...
+
+
diff --git a/showcase/src/assets/translations/en.json b/showcase/src/assets/translations/en.json
index 6a84be197e..b90514f8c5 100644
--- a/showcase/src/assets/translations/en.json
+++ b/showcase/src/assets/translations/en.json
@@ -87,6 +87,10 @@
"LOGOUT": {
"LOGOUT_DEFAULT_ICON": "Logout button - Default icon",
"LOGOUT_CUSTOM_ICON": "Logout button - Custom icon"
+ },
+ "SIDEBAR": {
+ "TITLE": "App Sidebar",
+ "INTRO": "The preview of this code is the actual sidebar of the showcase"
}
},
"STYLEGUIDE": {
diff --git a/showcase/src/assets/translations/fr.json b/showcase/src/assets/translations/fr.json
index b3264582df..2b56ac8ece 100644
--- a/showcase/src/assets/translations/fr.json
+++ b/showcase/src/assets/translations/fr.json
@@ -87,6 +87,10 @@
"LOGOUT": {
"LOGOUT_DEFAULT_ICON": "Bouton logout - Icône par défaut",
"LOGOUT_CUSTOM_ICON": "Bouton logout - Icône custom"
+ },
+ "SIDEBAR": {
+ "TITLE": "App Sidebar",
+ "INTRO": "La sidebar du showcase illustre ce code."
}
},
"STYLEGUIDE": {
diff --git a/showcase/src/assets/translations/nl.json b/showcase/src/assets/translations/nl.json
index ceaf497042..0e72b01e05 100644
--- a/showcase/src/assets/translations/nl.json
+++ b/showcase/src/assets/translations/nl.json
@@ -87,6 +87,10 @@
"LOGOUT": {
"LOGOUT_DEFAULT_ICON": "Logout-knop - Standaard pictogram",
"LOGOUT_CUSTOM_ICON": "Logout-knop - Aangepast pictogram"
+ },
+ "SIDEBAR": {
+ "TITLE": "App Sidebar",
+ "INTRO": "De preview van deze code is de eigenlijke zijbalk van de showcase"
}
},
"STYLEGUIDE": {
diff --git a/showcase/src/styles/_sidenav_temp.scss b/showcase/src/styles/_sidenav_temp.scss
deleted file mode 100644
index 82563c3d4b..0000000000
--- a/showcase/src/styles/_sidenav_temp.scss
+++ /dev/null
@@ -1,34 +0,0 @@
-.mat-sidenav-content,
-.mat-sidenav {
- margin-top: $stark-header-size;
-}
-
-mat-sidenav.mat-drawer {
- background-color: #16385a;
- width: 200px;
-}
-
-mat-sidenav.mat-drawer .mat-nav-list {
- padding-top: 0;
-}
-
-mat-sidenav.mat-drawer .mat-nav-list .mat-list-item {
- color: #fff;
- font-size: 13px;
-}
-
-mat-sidenav.mat-drawer .mat-list-item:hover a {
- background-color: rgba($color: #fff, $alpha: 0.3);
-}
-
-mat-sidenav.mat-drawer .mat-list-item-focus.active,
-mat-sidenav.mat-drawer a.active {
- background-color: rgba($color: #fff, $alpha: 0.4);
-}
-
-@media #{$tablet-query} {
- .mat-sidenav-content,
- .mat-sidenav {
- margin-top: $stark-header-size-desktop;
- }
-}
diff --git a/showcase/src/styles/_stark-styles.scss b/showcase/src/styles/_stark-styles.scss
index 60ec10ecb8..739e320df3 100644
--- a/showcase/src/styles/_stark-styles.scss
+++ b/showcase/src/styles/_stark-styles.scss
@@ -9,6 +9,8 @@ IMPORTANT: Stark styles are provided as SCSS styles so they should be imported i
@import "~@nationalbankbelgium/stark-ui/src/modules/app-logo/components/app-logo.component";
@import "~@nationalbankbelgium/stark-ui/src/modules/action-bar/components/action-bar-theme";
@import "~@nationalbankbelgium/stark-ui/src/modules/action-bar/components/action-bar.component";
+@import "~@nationalbankbelgium/stark-ui/src/modules/app-sidebar/components/app-sidebar-theme";
+@import "~@nationalbankbelgium/stark-ui/src/modules/app-sidebar/components/app-sidebar.component";
@import "~@nationalbankbelgium/stark-ui/src/modules/breadcrumb/components/breadcrumb.component";
@import "~@nationalbankbelgium/stark-ui/src/modules/date-range-picker/components/date-range-picker.component";
@import "~@nationalbankbelgium/stark-ui/src/modules/slider/components/slider-theme";
diff --git a/showcase/src/styles/styles.scss b/showcase/src/styles/styles.scss
index 9d985d6975..160a566371 100644
--- a/showcase/src/styles/styles.scss
+++ b/showcase/src/styles/styles.scss
@@ -2,7 +2,6 @@
@import "stark-styles.scss";
@import "../app/news/news-component/news.component";
-@import "sidenav_temp";
@import "~basscss/css/basscss.css";
@import "~normalize.css/normalize.css";