Skip to content

Commit 042bea5

Browse files
committed
added breadcrumbs option
1 parent e045943 commit 042bea5

6 files changed

Lines changed: 43 additions & 5 deletions

File tree

ui/src/app/components/options/options.component.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@
3939
<div *ngIf="option.type === 'label'"
4040
[class]="option.url ? 'clickable' : ''"
4141
(click)="openUrl(option.url)"
42-
[eqmTooltip]="option.tooltip"
42+
fxLayout="row" fxLayoutGap="5px" fxLayoutAlign="center center"
4343
>
4444
<eqm-label>{{option.label}}</eqm-label>
45+
<eqm-question *ngIf="option.tooltip" [eqmTooltip]="option.tooltip"></eqm-question>
4546
</div>
4647

4748
<!-- HTML -->
@@ -60,6 +61,10 @@
6061
(itemSelected)="option.itemSelected($event)"
6162
></eqm-dropdown>
6263
</div>
64+
65+
<div *ngIf="option.type === 'breadcrumbs'">
66+
<eqm-breadcrumbs [crumbs]="option.crumbs" (crumbClicked)="option.crumbClicked($event)"></eqm-breadcrumbs>
67+
</div>
6368
</div>
6469
</div>
6570
</div>

ui/src/app/components/options/options.component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,15 @@ export interface SelectOption extends BaseOptions {
5959
selected?: (id: string) => any
6060
}
6161

62-
export type Option = ButtonOption | CheckboxOption | SelectOption | DividerOption | LabelOption | HTMLOption | DropdownOption
62+
export interface BreadcrumbsOption extends Omit<BaseOptions, 'key' | 'label'> {
63+
type: 'breadcrumbs'
64+
crumbs: string[]
65+
crumbClicked: (event: { crumb: string, index: number }) => void | Promise<void>
66+
}
67+
68+
export type Option = ButtonOption | CheckboxOption | SelectOption
69+
| DividerOption | LabelOption | HTMLOption | DropdownOption
70+
| BreadcrumbsOption
6371

6472
export type Options = Option[][]
6573
@Component({
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div fxLayout="row" fxLayoutGap="5px" fxLayoutAlign="center center">
2+
<div *ngFor="let crumb of crumbs; index as i" fxLayout="row" fxLayoutGap="5px" fxLayoutAlign="center center">
3+
<eqm-icon *ngIf="i !== 0" name="triangle" [rotate]="90"></eqm-icon>
4+
<eqm-label (click)="crumbClicked.emit({ crumb: crumb, index: index })">{{crumb}}</eqm-label>
5+
</div>
6+
</div>

ui/src/app/modules/eqmac-components/components/breadcrumbs/breadcrumbs.component.scss

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2+
3+
@Component({
4+
selector: 'eqm-breadcrumbs',
5+
templateUrl: './breadcrumbs.component.html',
6+
styleUrls: ['./breadcrumbs.component.scss']
7+
})
8+
export class BreadcrumbsComponent implements OnInit {
9+
@Input() crumbs: string[]
10+
@Output() crumbClicked = new EventEmitter<{ crumb: string, index: number }>()
11+
constructor() { }
12+
13+
ngOnInit(): void {
14+
}
15+
16+
}

ui/src/app/modules/eqmac-components/eqmac-components.module.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
4646
import { CarouselComponent, CarouselItemDirective, CarouselItemElement } from './components/carousel/carousel.component'
4747
import { QuestionComponent } from './components/question/question.component'
4848
import { ClickedOutsideDirective } from './directives/clicked-outside.directive'
49-
import { ScrollingModule } from '@angular/cdk/scrolling'
49+
import { ScrollingModule } from '@angular/cdk/scrolling';
50+
import { BreadcrumbsComponent } from './components/breadcrumbs/breadcrumbs.component'
5051

5152
@NgModule({
5253
imports: [
@@ -85,7 +86,8 @@ import { ScrollingModule } from '@angular/cdk/scrolling'
8586
CarouselComponent,
8687
CarouselItemElement,
8788
CarouselItemDirective,
88-
QuestionComponent
89+
QuestionComponent,
90+
BreadcrumbsComponent
8991
],
9092
exports: [
9193
ClickedOutsideDirective,
@@ -112,7 +114,8 @@ import { ScrollingModule } from '@angular/cdk/scrolling'
112114
CheckboxComponent,
113115
CarouselComponent,
114116
CarouselItemDirective,
115-
QuestionComponent
117+
QuestionComponent,
118+
BreadcrumbsComponent
116119
],
117120
providers: [
118121
UtilitiesService

0 commit comments

Comments
 (0)