Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | 1x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 1x 110x | import { ChangeDetectionStrategy, Component, Injector, Input, ViewEncapsulation } from '@angular/core';
import { TamuAbstractBaseComponent } from '../shared/tl-abstract-base.component';
@Component({
selector: 'tl-header-component',
templateUrl: './tl-header.component.html',
styleUrls: ['./tl-header.component.scss'],
encapsulation: ViewEncapsulation.ShadowDom,
changeDetection: ChangeDetectionStrategy.Default
})
export class TlHeaderComponent extends TamuAbstractBaseComponent {
/** This is a URL pointing to the location of the logo. */
logoSrc = `${this.appConfig.assetsUrl}/icons/tl/tamu-logo.svg`;
askUsSrc = `${this.appConfig.assetsUrl}/images/askus.png`;
/** The text value to be displayed beside the TAMU logo. */
logoText = ' Texas A&M University Libraries';
/** This defines the height of the TAMU logo. */
logoImgHeight = 'var(--tl-logo-img-height)';
/** This defines the width of the TAMU logo. */
logoImgWidth = 'var(--tl-logo-img-width)';
/** This defines the margin of the TAMU logo. */
logoImgMargin = 'var(--tl-logo-img-margin)';
/** This is the href for the logo */
logoHref = 'https://library.tamu.edu';
/** This defines the TAMU css variable: --tl-primary. */
titleRowBackground = 'var(--tl-primary)';
/** This defines the css variable: --tl-primary-dark-accent. */
topNavBackground = 'var(--tl-primary-dark-accent)';
/** This defines the TAMU css variable: grayColor. */
bottomNavBackground = 'var(--tl-grey)';
/** This defines the TAMU page header title and is displayed as page title. */
@Input() pageTitle = 'TL Header Component';
@Input() pageTitleUrl = '/';
/** This boolean attribute is used to supress display of "Give to the Libraries" button. */
@Input() suppressCallToAction: 'true' | 'false' = 'false';
/** This defines an array containing each top navigation to be suppressed or contains 'all' to suppress all top navigation. */
suppressTopNavList: Array<string> = [];
mobileMenuClosed = true;
// tslint:disable-next-line:unnecessary-constructor
constructor(injector: Injector) {
super(injector);
}
/**
* Toggles Mobile Menu from open to closed.
*/
toggleMobileMenu(): void {
this.mobileMenuClosed = !this.mobileMenuClosed;
}
/**
* Designates top navigation to suppress.
*
* @param value
* - A CSV string of supported top navigation names.
* - May specify 'all' to designate suppression of all top navigation.
* - Each CSV will be trimmed.
* - Each CSV will be treated in a case insensitive manner.
*/
@Input() set suppressTopNav(value: string) {
this.suppressTopNavList.length = 0;
const sanitized = value
.trim()
.toLowerCase();
if (sanitized === 'all') {
this.suppressTopNavList.push('all');
} else {
const values = value.split(',');
for (const name of values) {
this.suppressTopNavList.push(name
.trim()
.toLowerCase());
}
}
}
/**
* Method for checking whether or not a given top navigation is to be suppressed.
*
* @param value
* - The name of the top navigation.
* - This will be trimmed.
* - This is treated in a case insensitive manner.
*
* @returns
* - TRUE when the top navigation is not to be suppressed.
* - FALSE when the top navigation is to be suppressed.
*/
showTopNav(value: string): boolean {
return this.suppressTopNavList.indexOf('all') === -1
&& this.suppressTopNavList.indexOf(value
.trim()
.toLowerCase()) === -1;
}
}
|