Skip to content

Commit 53139f9

Browse files
committed
docs(nav): relocate component into its own folder for better structure
1 parent ef70029 commit 53139f9

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed
File renamed without changes.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.dev/license
7+
*/
8+
9+
import {Component, inject} from '@angular/core';
10+
import {AsyncPipe} from '@angular/common';
11+
import {MatListItem, MatNavList} from '@angular/material/list';
12+
import {ActivatedRoute, RouterLinkActive, RouterLink} from '@angular/router';
13+
import {of} from 'rxjs';
14+
import {switchMap} from 'rxjs/operators';
15+
16+
import {DocumentationItems} from '../../shared/documentation-items/documentation-items';
17+
18+
@Component({
19+
selector: 'app-component-nav',
20+
templateUrl: './component-nav.html',
21+
imports: [MatNavList, MatListItem, RouterLinkActive, RouterLink, AsyncPipe],
22+
})
23+
export class ComponentNav {
24+
private _docItems = inject(DocumentationItems);
25+
private _route = inject(ActivatedRoute);
26+
protected _params = this._route.params;
27+
28+
items = this._params.pipe(
29+
switchMap(params => (params?.section ? this._docItems.getItems(params.section) : of([]))),
30+
);
31+
}

docs/src/app/pages/component-sidenav/component-sidenav.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ import {
1717
} from '@angular/core';
1818
import {BreakpointObserver} from '@angular/cdk/layout';
1919
import {AsyncPipe} from '@angular/common';
20-
import {MatListItem, MatNavList} from '@angular/material/list';
2120
import {MatSidenav, MatSidenavContainer} from '@angular/material/sidenav';
22-
import {ActivatedRoute, Routes, RouterOutlet, RouterLinkActive, RouterLink} from '@angular/router';
23-
import {Observable, of, Subscription} from 'rxjs';
24-
import {map, switchMap} from 'rxjs/operators';
21+
import {Routes, RouterOutlet} from '@angular/router';
22+
import {Observable, Subscription} from 'rxjs';
23+
import {map} from 'rxjs/operators';
2524

2625
import {DocumentationItems} from '../../shared/documentation-items/documentation-items';
2726
import {Footer} from '../../shared/footer/footer';
@@ -37,6 +36,7 @@ import {
3736
ComponentViewer,
3837
} from '../component-viewer/component-viewer';
3938
import {ComponentStyling} from '../component-viewer/component-styling';
39+
import {ComponentNav} from '../component-nav/component-nav';
4040

4141
// These constants are used by the ComponentSidenav for orchestrating the MatSidenav in a responsive
4242
// way. This includes hiding the sidenav, defaulting it to open, changing the mode from over to
@@ -105,21 +105,6 @@ export class ComponentSidenav implements OnInit, OnDestroy {
105105
}
106106
}
107107

108-
@Component({
109-
selector: 'app-component-nav',
110-
templateUrl: './component-nav.html',
111-
imports: [MatNavList, MatListItem, RouterLinkActive, RouterLink, AsyncPipe],
112-
})
113-
export class ComponentNav {
114-
private _docItems = inject(DocumentationItems);
115-
private _route = inject(ActivatedRoute);
116-
protected _params = this._route.params;
117-
118-
items = this._params.pipe(
119-
switchMap(params => (params?.section ? this._docItems.getItems(params.section) : of([]))),
120-
);
121-
}
122-
123108
export const componentSidenavRoutes: Routes = [
124109
{
125110
path: '',

0 commit comments

Comments
 (0)