([this.startBreadcrumb]);
+
+ get breadcrumbsItems(): NavigationBreadcrumbsItem[] {
+ return this._breadcrumbsItems$.getValue();
+ }
+
constructor(private router: Router) {
super();
super.unsubscribeOnDestroy(
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
- const url = this.router.url;
- this.path = url.split('/')[1].split('?')[0] || '';
+ const paths = this.router.url.split('/');
+
+ this._breadcrumbsItems$.next([
+ this.startBreadcrumb,
+ ...[...paths]
+ .filter(path => !!path)
+ .map(path => ({
+ text: `${path.charAt(0).toUpperCase()}${path.slice(1)}`,
+ routerLink: paths.slice(0, paths.length - 1).join('/'),
+ })),
+ ]);
+
+ this.path = paths[1].split('?')[0] || '';
})
);
}
get appClass(): string {
- let defaultClass = `dafa dafa--${this.path.length ? this.path : 'home'}`;
-
- return defaultClass;
+ return `dafa dafa--${this.path.length ? this.path : 'home'}`;
}
}
diff --git a/apps/dafa-web/src/app/app.module.ts b/apps/dafa-web/src/app/app.module.ts
index 595c09b..75dc690 100644
--- a/apps/dafa-web/src/app/app.module.ts
+++ b/apps/dafa-web/src/app/app.module.ts
@@ -1,4 +1,4 @@
-import { DigiNgTypographyBaseModule } from '@af/digi-ng/_typography/typography-base';
+import { DigiNgNavigationBreadcrumbsModule } from '@af/digi-ng/_navigation/navigation-breadcrumbs';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@@ -17,7 +17,7 @@ import { SkipToContentModule } from './components/skip-to-content/skip-to-conten
SkipToContentModule,
NavigationModule,
SidebarModule,
- DigiNgTypographyBaseModule,
+ DigiNgNavigationBreadcrumbsModule,
],
providers: [],
bootstrap: [AppComponent],
diff --git a/apps/dafa-web/src/app/components/navigation/navigation.component.html b/apps/dafa-web/src/app/components/navigation/navigation.component.html
index ab2d5a6..45dfa3a 100644
--- a/apps/dafa-web/src/app/components/navigation/navigation.component.html
+++ b/apps/dafa-web/src/app/components/navigation/navigation.component.html
@@ -19,7 +19,7 @@
- {{ user.id }}
+ {{ user.name }}
diff --git a/apps/dafa-web/src/app/components/sidebar/sidebar.component.html b/apps/dafa-web/src/app/components/sidebar/sidebar.component.html
index 7c0cf89..5635fdd 100644
--- a/apps/dafa-web/src/app/components/sidebar/sidebar.component.html
+++ b/apps/dafa-web/src/app/components/sidebar/sidebar.component.html
@@ -12,56 +12,37 @@
+