openaire-library/utils/mobile-dropdown/mobile-dropdown.component.ts

37 lines
841 B
TypeScript

import {Component, Input, OnInit} from "@angular/core";
@Component({
selector: 'mobile-dropdown',
template: `
<div class="uk-dropdown-mobile" [class.uk-open]="opened">
<div class="uk-dropdown-mobile-container">
<a class="uk-close" (click)="close()">
<icon name="close" [ratio]="1.2"></icon>
</a>
<div class="uk-content">
<ng-content></ng-content>
</div>
</div>
</div>`
})
export class MobileDropdownComponent implements OnInit{
@Input() toggle: HTMLLinkElement;
public opened: boolean = false;
ngOnInit() {
if(this.toggle) {
this.toggle.onclick = (ev) => {
this.opened = !this.opened;
}
}
}
open() {
this.opened = true;
}
close() {
this.opened = false;
}
}