From 6a8983b17aa4275fa0b255c409de8a8cc854a17d Mon Sep 17 00:00:00 2001 From: imagoiq <12294151+imagoiq@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:11:59 +0100 Subject: [PATCH 1/9] chore(demo, intranet-header-workspace): Refactor intranet-header demo --- packages/demo/src/app/app-routing.module.ts | 34 +- packages/demo/src/app/app.component.html | 469 +----------------- packages/demo/src/app/app.component.ts | 38 +- packages/demo/src/app/app.module.ts | 9 +- ...et-header-demo-big-sidebar.component.html} | 4 +- ...header-demo-big-sidebar.component.spec.ts} | 10 +- ...anet-header-demo-big-sidebar.component.ts} | 4 +- ...ntranet-header-demo-regular.component.html | 19 + .../intranet-header-demo-regular.component.ts | 8 + ...-header-demo-small-sidebar.component.html} | 8 +- ...ader-demo-small-sidebar.component.spec.ts} | 10 +- ...et-header-demo-small-sidebar.component.ts} | 4 +- .../intranet-components.module.ts | 17 +- .../intranet-layout.component.css | 63 --- .../intranet-layout.component.html | 60 +-- .../intranet-layout.component.ts | 29 +- .../layout-container.component.html | 468 +++++++++++++++++ .../layout-container.component.scss} | 0 .../layout-container.component.ts | 39 ++ .../alert-demo-page.component.html | 2 +- .../intranet-header-workspace/angular.json | 44 +- .../intranet-header-workspace/package.json | 1 + .../src/app.component.ts | 9 + .../src/app.module.ts | 32 ++ .../src/app/app.component.ts | 13 - .../src/app/app.module.ts | 14 - .../intranet-header-showcase/src/main.ts | 5 +- .../navigation/navigation.component.html} | 0 .../navigation/navigation.component.scss} | 0 .../navigation/navigation.component.spec.ts} | 16 +- .../navigation/navigation.component.ts | 12 + .../src/samples/samples-index.component.ts | 13 + .../sidebar-with-searchbar.component.html | 71 +++ .../sidebar-with-searchbar.component.ts | 10 + .../samples/sidebar/sidebar.component.html | 63 +++ .../src/samples/sidebar/sidebar.component.ts | 10 + .../intranet-header-showcase/src/styles.scss | 4 - .../swisspost-intranet-header.component.html | 246 +++++---- .../swisspost-intranet-header.component.scss | 63 --- .../swisspost-intranet-header.component.ts | 3 +- pnpm-lock.yaml | 93 +--- 41 files changed, 1000 insertions(+), 1017 deletions(-) rename packages/demo/src/app/intranet-layout/components/{intranet-header-big/intranet-header-big.component.html => intranet-header-demo-big-sidebar/intranet-header-demo-big-sidebar.component.html} (96%) rename packages/demo/src/app/intranet-layout/components/{intranet-header-big/intranet-header-big.component.spec.ts => intranet-header-demo-big-sidebar/intranet-header-demo-big-sidebar.component.spec.ts} (62%) rename packages/demo/src/app/intranet-layout/components/{intranet-header-big/intranet-header-big.component.ts => intranet-header-demo-big-sidebar/intranet-header-demo-big-sidebar.component.ts} (89%) create mode 100644 packages/demo/src/app/intranet-layout/components/intranet-header-demo-regular/intranet-header-demo-regular.component.html create mode 100644 packages/demo/src/app/intranet-layout/components/intranet-header-demo-regular/intranet-header-demo-regular.component.ts rename packages/demo/src/app/intranet-layout/components/{intranet-header-small/intranet-header-small.component.html => intranet-header-demo-small-sidebar/intranet-header-demo-small-sidebar.component.html} (93%) rename packages/demo/src/app/intranet-layout/components/{intranet-header-small/intranet-header-small.component.spec.ts => intranet-header-demo-small-sidebar/intranet-header-demo-small-sidebar.component.spec.ts} (57%) rename packages/demo/src/app/intranet-layout/components/{intranet-header-small/intranet-header-small.component.ts => intranet-header-demo-small-sidebar/intranet-header-demo-small-sidebar.component.ts} (84%) create mode 100644 packages/demo/src/app/layout-container/layout-container.component.html rename packages/demo/src/app/{app.component.scss => layout-container/layout-container.component.scss} (100%) create mode 100644 packages/demo/src/app/layout-container/layout-container.component.ts create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/app.component.ts create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/app.module.ts delete mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/app/app.component.ts delete mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/app/app.module.ts rename packages/intranet-header-workspace/projects/intranet-header-showcase/src/{app/app.component.html => samples/navigation/navigation.component.html} (100%) rename packages/intranet-header-workspace/projects/intranet-header-showcase/src/{app/app.component.scss => samples/navigation/navigation.component.scss} (100%) rename packages/intranet-header-workspace/projects/intranet-header-showcase/src/{app/app.component.spec.ts => samples/navigation/navigation.component.spec.ts} (59%) create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/samples/navigation/navigation.component.ts create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/samples/samples-index.component.ts create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/samples/sidebar-with-searchbar/sidebar-with-searchbar.component.html create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/samples/sidebar-with-searchbar/sidebar-with-searchbar.component.ts create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/samples/sidebar/sidebar.component.html create mode 100644 packages/intranet-header-workspace/projects/intranet-header-showcase/src/samples/sidebar/sidebar.component.ts diff --git a/packages/demo/src/app/app-routing.module.ts b/packages/demo/src/app/app-routing.module.ts index 71440d3bb9..d127b80876 100644 --- a/packages/demo/src/app/app-routing.module.ts +++ b/packages/demo/src/app/app-routing.module.ts @@ -50,14 +50,24 @@ import { StepperDemoPageComponent } from './post-sample/components/stepper/stepp import { DatatableDemoPageComponent } from './post-sample/components/datatable/datatable-demo-page/datatable-demo-page.component'; import { FormsDemoPageComponent } from './post-sample/components/forms/forms-demo-page/forms-demo-page.component'; import { PostCardsDemoPageComponent } from './post-sample/components/post-cards/post-cards-demo-page/post-cards-demo-page.component'; +import { LayoutContainerComponent } from './layout-container/layout-container.component'; +import { IntranetHeaderDemoRegularComponent } from './intranet-layout/components/intranet-header-demo-regular/intranet-header-demo-regular.component'; +import { IntranetHeaderDemoBigSidebarComponent } from './intranet-layout/components/intranet-header-demo-big-sidebar/intranet-header-demo-big-sidebar.component'; +import { IntranetHeaderDemoSmallSidebarComponent } from './intranet-layout/components/intranet-header-demo-small-sidebar/intranet-header-demo-small-sidebar.component'; /* tslint:enable:max-line-length */ const routes: Routes = [ { path: '', redirectTo: 'home', pathMatch: 'full' }, - { path: 'home', component: HomeComponent, data: { fullWidth: true } }, + { + path: 'home', + component: LayoutContainerComponent, + data: { fullWidth: true }, + children: [{ path: '', component: HomeComponent, data: { fullWidth: true } }], + }, { path: 'bootstrap-samples', + component: LayoutContainerComponent, children: [ { path: 'accordion', component: AccordionDemoPageComponent }, { path: 'alerts', component: AlertDemoPageComponent }, @@ -90,6 +100,7 @@ const routes: Routes = [ }, { path: 'ng-bootstrap-samples', + component: LayoutContainerComponent, children: [ { path: 'accordion', component: NgbAccordionDemoPageComponent }, { path: 'rating', component: NgbRatingDemoPageComponent }, @@ -114,6 +125,7 @@ const routes: Routes = [ }, { path: 'post-samples', + component: LayoutContainerComponent, children: [ { path: 'accordion', component: AccordionDemoPageComponent }, { path: 'datatable', component: DatatableDemoPageComponent }, @@ -135,10 +147,24 @@ const routes: Routes = [ { path: 'custom-select', component: CustomSelectDemoPageComponent }, { path: 'stepper', component: StepperDemoPageComponent }, { path: 'forms', component: FormsDemoPageComponent }, + { path: 'intranet-layout', component: IntranetLayoutComponent, data: { fullWidth: true } }, + ], + }, + + { + path: 'samples', + children: [ { - path: 'intranet-layout', - component: IntranetLayoutComponent, - data: { fullWidth: true }, + path: 'intranet-layout-regular', + component: IntranetHeaderDemoRegularComponent, + }, + { + path: 'intranet-layout-sidebar-big-sidebar', + component: IntranetHeaderDemoBigSidebarComponent, + }, + { + path: 'intranet-layout-sidebar-small-sidebar', + component: IntranetHeaderDemoSmallSidebarComponent, }, ], }, diff --git a/packages/demo/src/app/app.component.html b/packages/demo/src/app/app.component.html index 504c069775..0680b43f9c 100644 --- a/packages/demo/src/app/app.component.html +++ b/packages/demo/src/app/app.component.html @@ -1,468 +1 @@ -
- -
- - -
- - {{ version.title }} -
- - Angular Logo - {{ angularVersion.format('x.x') }} - - - Bootstrap Logo - {{ bootstrapVersion.format('x.x') }} - - - ng-bootstrap Logo - {{ ngBootstrapVersion.format('x.x') }} - -
-
-
-
-
- - - - - - - -
-
-
- -
-
- - -
- - - - + diff --git a/packages/demo/src/app/app.component.ts b/packages/demo/src/app/app.component.ts index 0020e7bc14..7c802bdc05 100644 --- a/packages/demo/src/app/app.component.ts +++ b/packages/demo/src/app/app.component.ts @@ -1,43 +1,9 @@ -import { Component, OnInit } from '@angular/core'; -import { Router, NavigationEnd, ActivatedRoute } from '@angular/router'; -import { filter, map, mergeMap } from 'rxjs/operators'; -import { VersionService } from './common/version.service'; +import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'], }) -export class AppComponent implements OnInit { - public setFullwidthContainer: boolean = false; +export class AppComponent { public title = 'app'; - public versions$; - public currentVersion$; - - constructor( - private versionService: VersionService, - public router: Router, - private route: ActivatedRoute, - ) {} - - ngOnInit() { - this.versions$ = this.versionService.versions; - this.currentVersion$ = this.versionService.currentVersion; - - this.router.events - .pipe( - filter(e => e instanceof NavigationEnd), - map(() => this.route), - map(route => { - while (route.firstChild) { - route = route.firstChild; - } - return route; - }), - mergeMap(route => route.data), - ) - .subscribe(data => { - this.setFullwidthContainer = !!data.fullWidth; - }); - } } diff --git a/packages/demo/src/app/app.module.ts b/packages/demo/src/app/app.module.ts index de9e1223da..ae280f1155 100644 --- a/packages/demo/src/app/app.module.ts +++ b/packages/demo/src/app/app.module.ts @@ -27,6 +27,7 @@ import { SwissPostIntranetHeaderModule } from '@swisspost/design-system-intranet import { HomeComponent } from './home/home.component'; import { PostCommonModule } from './common/post-common.module'; import { HttpClientModule } from '@angular/common/http'; +import { LayoutContainerComponent } from './layout-container/layout-container.component'; registerLocaleData(localeDe); registerLocaleData(localeFr); @@ -34,7 +35,13 @@ registerLocaleData(localeIt); registerLocaleData(localeEn); @NgModule({ - declarations: [AppComponent, IntranetLayoutComponent, HomeComponent, CopyToClipboardDirective], + declarations: [ + AppComponent, + IntranetLayoutComponent, + LayoutContainerComponent, + HomeComponent, + CopyToClipboardDirective, + ], imports: [ BrowserModule, AppRoutingModule, diff --git a/packages/demo/src/app/intranet-layout/components/intranet-header-big/intranet-header-big.component.html b/packages/demo/src/app/intranet-layout/components/intranet-header-demo-big-sidebar/intranet-header-demo-big-sidebar.component.html similarity index 96% rename from packages/demo/src/app/intranet-layout/components/intranet-header-big/intranet-header-big.component.html rename to packages/demo/src/app/intranet-layout/components/intranet-header-demo-big-sidebar/intranet-header-demo-big-sidebar.component.html index e011539e23..f47b45e54c 100644 --- a/packages/demo/src/app/intranet-layout/components/intranet-header-big/intranet-header-big.component.html +++ b/packages/demo/src/app/intranet-layout/components/intranet-header-demo-big-sidebar/intranet-header-demo-big-sidebar.component.html @@ -1,5 +1,5 @@ -