How to add line break to custom tooltip directive using angular 7 - html

I am new to angular 7 directives. I created a custom tooltip directive using angular 7. Now, I am unable to specify line breaks when i pass the tooltip text from my html. I want a line break after the Tootltip Title text I pass from html. Any idea how to achieve this?
Tried to pass
and 
 code for line break in my input string to the tooltip directive. Didn't work either.
Here is what I tried so far.
My directive : tooltip.directive.ts:
import { Directive, Input, ElementRef, HostListener, Renderer2 } from '#angular/core';
#Directive({
selector: '[tooltip]'
})
export class TooltipDirective {
#Input('tooltip') tooltipTitle: string;
#Input() placement: string;
#Input() delay: number;
tooltip: HTMLElement;
offset = 10;
constructor(private el: ElementRef, private renderer: Renderer2) { }
#HostListener('mouseenter') onMouseEnter() {
if (!this.tooltip) { this.show(); }
}
#HostListener('mouseleave') onMouseLeave() {
if (this.tooltip) { this.hide(); }
}
show() {
this.create();
this.setPosition();
this.renderer.addClass(this.tooltip, 'ng-tooltip-show');
}
hide() {
this.renderer.removeClass(this.tooltip, 'ng-tooltip-show');
window.setTimeout(() => {
this.renderer.removeChild(document.body, this.tooltip);
this.tooltip = null;
}, 0);
}
create() {
this.tooltip = this.renderer.createElement('span');
this.renderer.appendChild(
this.tooltip,
this.renderer.createText(this.tooltipTitle) // textNode
);
this.renderer.appendChild(document.body, this.tooltip);
this.renderer.addClass(this.tooltip, 'ng-tooltip');
this.renderer.addClass(this.tooltip, `ng-tooltip-${this.placement}`);
}
setPosition() {
const hostPos = this.el.nativeElement.getBoundingClientRect();
const tooltipPos = this.tooltip.getBoundingClientRect();
let top, left;
if (this.placement === 'top') {
top = hostPos.top - tooltipPos.height - this.offset;
left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
}
/* other positions to be added */
this.renderer.setStyle(this.tooltip, 'top', `${top}px`);
this.renderer.setStyle(this.tooltip, 'left', `${left}px`);
}
}
CSS :
/* Styles for tooltip */
.ng-tooltip {
position: absolute;
max-width: 150px;
font-size: 14px;
text-align: center;
color: #f8f8f2;
padding: 3px 8px;
border-radius: 2px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);
background-color: #38393b;
z-index: 1000;
opacity: 0;
}
.ng-tooltip:after {
content: "";
position: absolute;
border-style: solid;
}
.ng-tooltip-top:after {
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-color: #38393b transparent transparent transparent;
}
.ng-tooltip-show {
opacity: 1;
}
From the html file, I invoke the tooltip directive by passing the text like this:
<div tooltip="Title: ( want a line break here) 
 {{someVariable}}" placement="top" class="remark">Hover Here</div>

This can be resolved by taking any of the approach,
Either create two different input such as #Input('Title'): string and #Input('Body'): string and pass into two different parameters.
OR
if you want to pass it in a single parameter make a use of interface such as
export interface IToolTip {
title?: string;
body: string;
footer?: string;
}
Assign this interface to your tooltip variable #Input('tooltip') tooltipTitle: ITooltip; Rest of the things can taken care under create() funciton.
Thanks.

Related

Angular assign css variable to before after class

Im trying to pass variable with [ngStyle] and read it on ::before class but unfortunately cannnot do it,
could someone point me on a right direction?
CSS:
.handle-slider__control {
height: 7px;
z-index:1;
background: $colour-alto;
position: relative;
margin:50px auto;
margin-bottom: 16px;
&.handle-slider__control--markers {
margin-bottom: 0;
}
}
.handle-slider__control::before {
position: absolute;
z-index:-1;
content:"";
left: var(--left);
right: var(--right);
background: $colour-red;
height:100%;
}
HTML:
<div [ngStyle]="getRangeColours()" class="handle-slider__control"></div>
And JS method:
getRangeColours()
{
return {"--left": "10%","--right": "10%"};
}
There is no information about wrongly passed data or anything. Im trying to change css parameters left, right based on data that are in component. If there is any other way to do it I would also consider it. THANKS!
Tested in Angular 9.1.11
test.component.ts
import { Component, OnInit, HostBinding } from '#angular/core';
#Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.scss']
})
export class TestComponent implements OnInit {
#HostBinding('style.--left.%') left: number = 20; // Change it to any Number at any point
#HostBinding('style.--right.%') right: number;
constructor() {}
ngOnInit(): void {
this.right = 10; // Change it to any Number at any point
}
}
test.component.html
<h2 class="handle-slider__control">CSS Variables in Angular</h2>
test.component.scss
.handle-slider__control {
height: 7px;
z-index:1;
background: blue;
position: relative;
margin:50px auto;
margin-bottom: 16px;
&.handle-slider__control--markers {
margin-bottom: 0;
}
}
.handle-slider__control::before {
position: absolute;
z-index:-1;
content:"";
left: var(--left);
right: var(--right);
background: red;
height:100%;
}
For Lower versions, try this (couldn't test though):
import { DomSanitizer } from '#angular/platform-browser';
public value: string;
#HostBinding("attr.style")
public get leftStyle(): any {
return this.sanitizer.bypassSecurityTrustStyle(`--left: value`);
}
constructor(private sanitizer: DomSanitizer) {
this.value = '10%';
}
About css variales thare are differents insteresting links about this, Take a look here or here, e.g.
I don't check it but
document.documentElement.style.setProperty('--left', "10%");
document.documentElement.style.setProperty('--rigth', "20%");
must be work
I just used different class instead of pseudocode with ngStyle on it like that:
.slider-colour-control {
position: absolute;
z-index:-1;
content:"";
background: $colour-red;
height:100%;
}

Angular show a list as a tooltip in mat date picker with bootstrap?

I need to show a tooltip which is a Html list on hover.
I can show the date highlighted and a simple message but the list wont show at all. It has to do with the bootstrap. If I remove bootstrap then it shows but I need bootstrap in the app. Is there any way to show a list in a tooltip on hover with bootstrap?
Here is the code
export class DatepickerDateClassExample {
list: string =
"Date - (3)<br/>" +
"Names - (4)<br/>" +
"Addresses - (25)<br>" +
"Values - (30)";
constructor(private renderer: Renderer2) {}
dates = [
{ date: "2020-04-20", text: this.list }
];
dateClass = (d: Date) => {
const dateSearch = this.dateToString(d);
return this.dates.find(f => f.date == dateSearch)
? "example-custom-date-class"
: undefined;
};
displayMonth() {
let elements = document.querySelectorAll(".endDate");
let x = elements[0].querySelectorAll(".mat-calendar-body-cell");
x.forEach(y => {
const dateSearch = this.dateToString(
new Date(y.getAttribute("aria-label"))
);
const data = this.dates.find(f => f.date == dateSearch);
if (data) y.setAttribute("aria-label", data.text);
});
}
streamOpened(event) {
setTimeout(() => {
let buttons = document.querySelectorAll("mat-calendar .mat-icon-button");
buttons.forEach(btn =>
this.renderer.listen(btn, "click", () => {
setTimeout(() => {
//debugger
this.displayMonth();
});
})
);
this.displayMonth();
});
}
dateToString(date: any) {
return (
date.getFullYear() +
"-" +
("0" + (date.getMonth() + 1)).slice(-2) +
"-" +
("0" + date.getDate()).slice(-2)
);
}
Css:
::ng-deep .example-custom-date-class {
background: orange;
border-radius: 100%;
}
.tooltip
{
display: none;
position: absolute;
text-align: center;
margin-top: 30px;
width: 155px;
padding: 10px;
z-index: 2000;
box-shadow: 0px 0px 4px #222;
border-radius: 10px;
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
color: gray;
}
.tooltip:before {
content: '';
display: block;
position: absolute;
left: 10px;
top: -20px;
width: 0;
height: 0;
border: 9px solid transparent;
border-bottom-color: #cccccc;
}
Html:
<mat-form-field class="example-full-width" >
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker (opened)="streamOpened($event)" [dateClass]="dateClass" #picker panelClass="endDate" ></mat-datepicker>
</mat-form-field>
<div #toolTip class="tooltip" (mouseover)="onTool=true"
(mouseout)="onTool=false"
[style.display]="show || onTool?'inline-block':'none'" [innerHTML]="toolTipMessage">
</div>
Here is the stackblitz
I'm afraid that you can not use a simple css, because content only admit \A to make a break line but it's not possible using attr -it's possible indicate que \A as string in the content- (and don't allow .html)
Well, we can take another aproach that is use a div that make as tooltip and use renderer to listen mouseout and mouseover
If our div is like
<div #toolTip class="tooltip"
(mouseover)="onTool=true"
(mouseout)="onTool=false"
[style.display]="show || onTool?'inline-block':'none'"
[innerHTML]="toolTipMessage">
</div>
And has two variables and get the div using ViewChild
#ViewChild('toolTip') tool:ElementRef
show:boolean=false;
onTool:boolean=false;
We can change our function displayMonth to add the mouseover and mouse out
displayMonth() {
let elements = document.querySelectorAll(".endDate");
let x = elements[0].querySelectorAll(".mat-calendar-body-cell");
x.forEach(y => {
const dateSearch = this.dateToString(
new Date(y.getAttribute("aria-label"))
);
const data = this.dates.find(f => f.date == dateSearch);
if (data) {
this.renderer.listen(y, "mouseover", () => this.showTool(y, data.text));
this.renderer.listen(y, "mouseout", () => this.hideTool());
}
});
}
showTool(y, data) {
this.show = true;
this.toolTipMessage = data;
this.renderer.setStyle(
this.tool.nativeElement,
"top",
y.getBoundingClientRect().y+ "px"
);
this.renderer.setStyle(
this.tool.nativeElement,
"left",
y.getBoundingClientRect().x + "px"
);
}
hideTool() {
this.show = false;
}
See the stackblitz
You just need to set the tooltip's opacity to 1. Bootstrap sets tooltip's classes opacity to 0 by default.
.tooltip
{
/*.... */
opacity: 1;
}
You could also just change your class name and not use tooltip.
Modified stackblitz
Explanation
If you use native bootstrap js, you normally need to call the .tooltip('show') method on the element for which the tooltip should appear. This will in turn change the opacity of the tooltip element.
Here, it looks like you are just using the css part of bootstrap, not the js lib, so you need to change the opacity yourself.
Note: using bootstrap's js requires jquery, which is not recommended in angular projects. There are some like libraries out there which provide bootstrap components for angular without requiring jquery, like ngx-bootstrap
Edit
Just for info, if you really wanted to use jquery and bootstrap for your tooltip, have a look at this stackblitz example.
Basically, you just call tooltip on the calendar dates and pass the text to display. Bootstrap will handle hiding/showing and positionning of the tooltip.
$(y).tooltip({'title': data.text, html: true});

How to enable scroll on background component even if a Modal is Open?

I have a problem with Angular and Material for Angular, I have an application with many modals, they all lock background scrolling when they're open, but I have a notification modal, this notification modal isn't intended to block background scrolling.
I don't have any .noScroll class in this modal, but the background page in relation to the modal still won't scroll, I want to the user to be able to scroll the page even with the notification modal open.
The notification modal is a DialogRef from Material for Angular.
I tried using overflow: visible and auto, also tried to modify the backdrop to enable scroll, but no success :(
How do I make the backdrop of this particular modal to enable scrolling and possible override other configurations of the code?
Edit: Here is part of the code >
ModalService:
{
constructor(private matDialog: MatDialog) {
}
openNotificationsModal(topOffset, rightOffset): MatDialogRef<NotificationsModalComponent> {
return this.notificationsModal(topOffset, rightOffset);
}
private notificationsModal(topOffset, rightOffset, clazz?: string): MatDialogRef<NotificationsModalComponent> {
const config = {
panelClass: clazz ? clazz : 'notifications-modal',
backdropClass: 'cdk-overlay-transparent-backdrop',
data: {
topOffset,
rightOffset,
}
};
return this.matDialog.open(NotificationsModalComponent, config);
}
}
this is my modal component:
import { Component } from '#angular/core';
import { MatDialogRef } from '#angular/material';
#Component({
selector: 'aa-notifications-modal',
templateUrl: './notifications-modal.component.html',
styles: []
})
export class NotificationsModalComponent {
constructor(private dialogRef: MatDialogRef<NotificationsModalComponent>) {}
async ngOnInit() {
this.dialogRef.updatePosition({
top: '2.5rem'
});
}
output() {
this.dialogRef.close();
}
}
this is the scss of this modal:
aa-notifications-modal {
width: 100%;
}
.notifications-modal {
width: 100%;
max-width: 100% !important;
pointer-events: none !important;
.mat-dialog-container {
display: flex;
justify-content: flex-end;
background: transparent;
width: 100%;
box-shadow: none;
}
.align-triangle {
display: flex;
justify-content: flex-end;
padding: 0;
.triangle {
margin-right: 4rem;
width: 0;
height: 0;
border-left: 25px solid transparent;
border-right: 25px solid transparent;
border-bottom: 25px solid #fff;
}
}
.space {
padding: 0;
}
.content-modal {
display: flex;
justify-content: flex-end;
margin-right: 8rem;
aa-notifications-list {
width: 427px;
pointer-events: auto;
border-radius: 5px;
}
}
}
As I can understand you need to find out where overflow: hidden; likely it will be on body tag, a simple solution you can try to set overflow: auto !important;
But more elegant will be to provide Scroll strategy into your Dialog

Angular reactive form dropdown without select and option tags

I ran into difficulty styling my dropdown : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#Styling_with_CSS
The select element is notoriously difficult to style productively with CSS.
in summary none of the hacks you can use on the option and select tags are worth their salt even in combination.
I'd love to continue using reactive forms but I wish to purify my html and css by using only <div> tags to draw up and use my dropdown in a reactive form.
is this possible?
here is my code as it exists today.
// this.statusForm = this.fb.group({
// status: ['Delivered', Validators.required]
// });
<form [formGroup]="statusForm">
<select formControlName="status">
<option value="Delivered">Delivered</option><!---->
<option value="Cancelled">Cancelled</option><!---->
<option value="UndeliveredTechnicalissue">Undelivered/Technical issue</option><!---->
</select>
</form>
the js is just the FormBuilder hydration.
I can gather/ console.log() the value using
this.statusForm.value.status;
You create the "options" part as ul>li or div and then style it accordingly.
The trick is to hide/show this part on mouse click or keyboard interaction, but for this you can use a boolean variable (here expanded).
Here a working Stackblitz.
If you want to look at the code in just one page, have a look to the code below:
template
<div class="select-container">
<input type="text"
[id]="customId"
[placeholder]="placeholder"
[value]= "selectedValue"
[disabled]="disabled"
(click)="showOptions()"/>
<ul class="select-menu box" role="listbox" *ngIf="expanded">
<li role="option"
*ngFor="let option of options; let i = index;"
[id]="customId + '-option-' + i"
[title]="option.label"
class="option-item"
[ngClass]="{ 'selected': activeItemIndex === i }"
(click)="selectItem(option)">
<span> {{option.label}}</span>
</li>
</ul>
</div>
component
#Component({
selector: 'form-select',
templateUrl: './form-select.component.html',
styleUrls: ['./form-select.component.scss'],
providers: [
{
provide: NG_VALUE_ACCESSOR,
multi: true,
useExisting: forwardRef(() => FormSelectComponent)
}
]
})
export class FormSelectComponent implements ControlValueAccessor{
public selectedValue = '';
public disabled = false;
public value: string;
#Input()
label: string;
#Input()
formCtrl: AbstractControl;
#Input()
pipe: { type?: string; params?: any };
#Input()
options: {key: string, label: string}[] = [];
#Input()
customId: string;
#Input()
placeholder: string;
public expanded = false;
public activeItemIndex: number;
public onChange(newVal: T) {}
public onTouched(_?: any) {}
public registerOnChange(fn: any): void {
this.onChange = fn;
}
public registerOnTouched(fn: any): void {
this.onTouched = fn;
writeValue(value: string) {
if (value && this.options) {
const match = this.options.find(
(item: { type?: string; params?: any }, index: number) => {
if (item.key === value) {
this.activeItemIndex = index;
return true;
}
}
);
this.selectedValue = match ? match.label : '';
}
}
showOptions() {
if (!this.disabled) {
this.expanded = true;
}
}
selectItem(item: {key: string, label: string}) {
this.value = item.key;
this.expanded = false;
this.selectedValue = item.label;
this.onChange(item.key);
}
}
scss styles
.select-container {
position: relative;
.input-container {
i {
position: absolute;
top: 1rem;
right: 1rem;
}
input[type='text'] {
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-right: 2rem;
}
}
.select-menu {
width: 100%;
z-index: 100;
max-height: 17.75rem;
overflow: auto;
position: absolute;
top: -5px;
right: 0;
background-color: white;
border: 1px solid gray;
padding: 1rem;
box-sizing: border-box;
.option-item {
padding-left: 1rem;
line-height: 3rem;
color: gray;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin: 0 -1rem;
&:last-child {
margin-bottom: 0;
}
&.selected,
&:hover {
background-color: lightgray;
color: black;
}
&:focus {
outline: none;
}
}
}
}
How to use it:
In template:
<form [formGroup]="mainFormGroup">
<form-select formControlName="myControl" [options]="options">
</form-select>
</form>
in component:
const options = [{
key: key1,
label: 'value_1'
}, {
key: key2,
label: 'value_2'
}];
this.mainFormGroup = this.fb.group({
myControl: ['']
});

Implement Three Section header with sticky sections

I have to implement a 3 section sticky header. The first section is a header part, the second section is a hero component, the 3d part is a subheader. When the user starts to scroll the page, 2nd section (hero component) disappears behind the header. The 3d section sticks to the header. If the user continues scrolling and scrolled 30% of the page, the 3d section also starts to hide behind the header.
I have some questions:
1) How to better organize the code (split the header into components)
2) And how to implement the described logic using Angular 8?
Maybe there are some examples with Angular 2+
I have implemented a subheader that hides the hero part on scroll
HTML
<div class="subheader__wrapper">
<div class="subheader subheader__sticky"
[ngClass]="getSubheaderClassTop()"
>
<div class="row align-middle align-justify subheader-row-height u-grid-full-width">
<cc-breadcrumb class="columns"></cc-breadcrumb>
<a *ngIf="!noBackButton" (click)="onBack()"
id="form-dropdown-back-link"
class="columns small-1 mos-u-text-size--md mos-u-color-text--white"
>
<my-icon size="lg" icon="keyboard_arrow_left" theme="disabled-light" alt="Back"></my-icon>
<span class="anchor-icon-text-fix">{{ 'subheader.back' | translate }}</span>
</a>
</div>
</div>
</div>
<hero
*ngIf="isHeroVisible"
class="mos-c-position--relative"
[backgroundUrl]="heroImageURL"
[backgroundImage]="gradient"
blendMode="multiply"
backgroundPosition="top"
flexDirection="row"
minHeight="192">
<div *ngIf="!isBlendMode" class="subheader__gradient"></div>
<div class="subheader__content flex-child-grow">
<div class="row x-large-row c-position--relative">
<div class="column medium-8 small-12 u-color-text--white x-large-6">
<h2 class="o-subheader-2" data-id="subheader">
{{ heroSubtitle }} {{heroSubtitleDate}}
</h2>
<h2 class="mos-o-display-2" data-id="header">
{{ heroTitle }}
</h2>
<hr class="subheader__separator c-hero--separator">
</div>
</div>
</div>
</hero>
CSS
:host {
display: block;
}
.subheader {
width: 100%;
height: 52px;
background-color: color(sapphire, 500);
z-index: 100;
&-row-height {
height: 52px;
}
&__sticky {
position: fixed;
}
&__gradient {
pointer-events: none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(255, 255, 255, 0.2) 100%);
}
&__content {
z-index: 1;
width: 100%;
justify-self: center;
.subheader__separator {
margin-right: auto;
}
}
}
.circle-step-position {
position: absolute;
top: 0;
left: 0;
z-index: 2;
}
JS
import {
AfterViewInit,
Component,
EventEmitter,
Input,
NgZone,
Output,
ElementRef,
ChangeDetectorRef,
ChangeDetectionStrategy,
} from '#angular/core';
import { TranslateService } from '#ngx-translate/core';
import { pathOr } from 'ramda';
import { AutoUnsubscribe } from '../shared/auto-unsubscribe.decorator';
import { WindowRef } from '../services/api/aot-ref/windowRef';
import { fromEvent } from 'rxjs';
import { takeUntil, distinctUntilChanged, map, throttleTime, startWith } from 'rxjs/operators';
#Component({
selector: 'cc-section-subheader',
templateUrl: './subheader.component.html',
styleUrls: ['./subheader.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
#AutoUnsubscribe
export class SubheaderComponent implements AfterViewInit {
componentDestroy;
#Input() subheader: string;
#Input() header: string;
#Input() country: string;
#Input() noBackButton: boolean;
#Input() heroTitle: string;
#Input() heroSubtitle: string;
#Input() heroSubtitleDate: string;
#Input() heroImageURL: string;
#Input() isHeroVisible = false;
#Input() isSummary = false;
#Input() isFileUpload = false;
#Input() isValidateData = false;
#Input() isJobMatch = false;
#Input() isAggregateValidation = false;
#Output() back = new EventEmitter<void>();
adjustSubheader = true;
lastScroll = 0;
lastHeight: string;
isExpanded = false;
isBlendMode = false;
constructor(
private ngZone: NgZone,
private window: WindowRef,
private subheaderElement: ElementRef,
private translate: TranslateService,
private cdr: ChangeDetectorRef,
) {
this.isBlendMode = !!('backgroundBlendMode' in document.body.style);
}
get areButtonsDisabled() {
return true;
}
get gradient(): string {
return this.isBlendMode
? 'linear-gradient(to right, black 0%, white 100%)'
: null;
}
ngAfterViewInit() {
this.ngZone.runOutsideAngular(() => {
fromEvent(this.window.nativeWindow, 'scroll')
.pipe(
map(() => this.isHeaderVisible()),
distinctUntilChanged(),
takeUntil(this.componentDestroy())
)
.subscribe((isHeaderVisible: boolean) => {
this.ngZone.run(() => {
this.adjustSubheader = isHeaderVisible;
this.cdr.detectChanges();
});
});
});
this.ngZone.runOutsideAngular(() => {
fromEvent(this.window.nativeWindow, 'resize').pipe(
startWith(null),
throttleTime(200),
takeUntil(this.componentDestroy()),
)
.subscribe(() => this.updateWrappersHeight());
});
}
/**
* Since sub-header has position set as fixed it removes the element from the normal document
* flow. To properly align content under it we need to set sub-header's height equal to
* sub-header.
*/
updateWrappersHeight(): void {
const el = this.subheaderElement.nativeElement;
const headerHeight = this.window.nativeWindow.getComputedStyle(el.querySelector('.subheader')).height;
if (headerHeight !== this.lastHeight) {
this.lastHeight = headerHeight;
el.querySelector('.subheader__wrapper').style.height = this.lastHeight;
}
}
onBack() {
this.back.emit();
}
getHtmlElementOffset(element: HTMLElement, offset = 0): number {
if (!element.offsetParent) {
return offset;
}
return this.getHtmlElementOffset(
element.offsetParent as HTMLElement,
offset + pathOr(0, ['offsetParent', 'offsetTop'], element),
);
}
getElementOffset(element: ElementRef): number {
if (!element) {
return 0;
}
return this.getHtmlElementOffset(
element.nativeElement,
element.nativeElement.offsetTop,
);
}
isHeaderVisible() {
const scrollTop = this.window.nativeWindow.pageYOffset;
const down = scrollTop > this.lastScroll;
const top = this.getElementOffset(this.subheaderElement);
this.lastScroll = scrollTop;
return scrollTop <= top;
}
getSubheaderClassTop(): string {
return this.adjustSubheader
? ''
: 'subheader__sticky--fixed-to-top';
}
}