|
| 1 | +import { Component, Input } from "@angular/core"; |
| 2 | +import { ListItem } from "./../dropdown/dropdown.module"; |
| 3 | +import { I18n } from "./../i18n/i18n.module"; |
| 4 | + |
| 5 | +@Component({ |
| 6 | + selector: "ibm-sidenav-header", |
| 7 | + template: ` |
| 8 | + <header class="bx--side-nav__header"> |
| 9 | + <div class="bx--side-nav__icon"> |
| 10 | + <ng-content select="[icon]"></ng-content> |
| 11 | + </div> |
| 12 | + <div class="bx--side-nav__details"> |
| 13 | + <h2 class="bx--side-nav__title" [title]="title">{{title}}</h2> |
| 14 | + <div class="bx--side-nav__switcher"> |
| 15 | + <label class="bx--assistive-text" [for]="switcherId"> |
| 16 | + {{i18n.get('UI_SHELL.SIDE_NAV.SWITCHER') | async}} |
| 17 | + </label> |
| 18 | + <select [id]="switcherId" class="bx--side-nav__select"> |
| 19 | + <option class="bx--side-nav__option" disabled="" value="" selected="" hidden=""> |
| 20 | + {{i18n.get('UI_SHELL.SIDE_NAV.SWITCHER') | async}} |
| 21 | + </option> |
| 22 | + <option |
| 23 | + *ngFor="let option of options" |
| 24 | + class="bx--side-nav__option" |
| 25 | + [value]="(option.value ? option.value : option.content)"> |
| 26 | + {{option.content}} |
| 27 | + </option> |
| 28 | + </select> |
| 29 | + <div class="bx--side-nav__switcher-chevron"> |
| 30 | + <svg |
| 31 | + focusable="false" |
| 32 | + preserveAspectRatio="xMidYMid meet" |
| 33 | + style="will-change: transform;" |
| 34 | + xmlns="http://www.w3.org/2000/svg" |
| 35 | + width="20" |
| 36 | + height="20" |
| 37 | + viewBox="0 0 32 32" |
| 38 | + aria-hidden="true"> |
| 39 | + <path d="M16 22L6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path> |
| 40 | + </svg> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + </header> |
| 45 | + ` |
| 46 | +}) |
| 47 | +export class SideNavHeader { |
| 48 | + @Input() title: string; |
| 49 | + @Input() options: ListItem[]; |
| 50 | + public switcherId = "sidenav-switcher"; |
| 51 | + |
| 52 | + constructor(public i18n: I18n) { } |
| 53 | +} |
0 commit comments