Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 4486ed3

Browse files
committed
Simplify application routes
1 parent b17882a commit 4486ed3

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/app/pages/component-category-list/component-category-list.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<md-card
33
*ngFor="let category of docItems.getItemsInCategories()"
44
class="docs-component-category-list-card"
5-
[routerLink]="['/components/category/', category.id]">
5+
[routerLink]="['/categories/', category.id]">
66
<md-card-title>{{category.name}}</md-card-title>
77
<p class="docs-component-category-list-card-summary">{{category.summary}}</p>
88
<docs-svg-viewer class="docs-component-category-list-card-image"

src/app/pages/component-list/component-list.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="docs-component-list-category">
22
<a *ngFor="let component of category.items"
33
class="docs-component-list-item"
4-
[routerLink]="['/components/component/', component.id]">
4+
[routerLink]="['/components/', component.id]">
55
<docs-svg-viewer class="docs-component-list-item-icon"
66
[attr.aria-label]="component.name"
77
[src]="'../../../assets/img/components/' + component.id + '.svg'">

src/app/pages/component-sidenav/component-sidenav.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<h3>{{category.name}}</h3>
77
<ul>
88
<li *ngFor="let component of category.items">
9-
<a [routerLink]="['/components/component/', component.id]"
9+
<a [routerLink]="['/components/', component.id]"
1010
routerLinkActive="docs-component-viewer-sidenav-item-selected">
1111
{{component.name}}
1212
</a>

src/app/routes.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ import {GuideViewer} from './pages/guide-viewer/guide-viewer';
99

1010
export const MATERIAL_DOCS_ROUTES: Routes = [
1111
{path: '', component: Homepage, pathMatch: 'full'},
12+
{
13+
path: 'categories',
14+
component: ComponentSidenav,
15+
children: [
16+
{path: '', component: ComponentCategoryList},
17+
{path: ':id', component: ComponentList},
18+
],
19+
},
1220
{
1321
path: 'components',
1422
component: ComponentSidenav,
1523
children: [
1624
{path: '', component: ComponentCategoryList},
17-
{path: 'category/:id', component: ComponentList},
18-
{path: 'component/:id', component: ComponentViewer},
25+
{path: 'component/:id', redirectTo: ':id', pathMatch: 'full'},
26+
{path: 'category/:id', redirectTo: '/categories/:id', pathMatch: 'full'},
27+
{path: ':id', component: ComponentViewer},
1928
],
2029
},
2130
{path: 'guides', component: GuideList},

0 commit comments

Comments
 (0)