Skip to content

Commit

Permalink
feat: types for internal breadcrumb list and route data for breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
udayvunnam committed Oct 30, 2019
1 parent cf839c8 commit 58c4729
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
17 changes: 17 additions & 0 deletions projects/xng-breadcrumb/src/lib/breadcrumb-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* route data for breadcrumb, that can be specified during route declaration
*/
export interface BreadcrumbData {
/**
* breacrumb label for a route
*/
breadcrumb?: string;
/**
* unique alias name for a route path
*/
breadcrumbAlias?: string;
/**
* hide or show the breadcrumb item
*/
skipBreadcrumb?: boolean;
}
29 changes: 24 additions & 5 deletions projects/xng-breadcrumb/src/lib/breadcrumb.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
/**
* Breadcrumb item built internally, private to this module
*/
export interface Breadcrumb {
label: string; // label for the route
route: string; // actual route with resolved param
alias?: string; // friendly name for a route
skip?: boolean; // whether to skip a breadcrumb from display
routeRegex?: string; // Route converted to Regex expression (if route has path params).
/**
* breacrumb label for a route
*/
label?: string;
/**
* actual route path with resolved param. Ex /mentor/2, connect/edit
*/
routeLink?: string;
/**
* unique alias name for a route path
*/
alias?: string;
/**
* hide or show the breadcrumb item
*/
skip?: boolean;
/**
* route with path params converted to a RegExp
* path '/mentor/:id' becomes routeRegex '/mentor/[^/]+', which can be matched against when needed
*/
routeRegex?: string;
}

0 comments on commit 58c4729

Please sign in to comment.