mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -04:00
39 lines
947 B
TypeScript
39 lines
947 B
TypeScript
import { EventEmitter, Component, Input, Output, ElementRef } from '@angular/core';
|
|
import { CardItem } from '../../pages/search/search';
|
|
|
|
@Component({
|
|
selector: 'error',
|
|
templateUrl: 'error.html'
|
|
})
|
|
export class Error
|
|
{
|
|
@Output()
|
|
onClose = new EventEmitter<CardItem>();
|
|
|
|
@Input()
|
|
cardItem: CardItem;
|
|
|
|
constructor(private elementRef: ElementRef)
|
|
{
|
|
}
|
|
|
|
close(ev) {
|
|
let translate = 'translate3d(110%, 0, 0)';
|
|
if (ev != null && ev.direction === 2) {
|
|
translate = 'translate3d(-110%, 0, 0)';
|
|
}
|
|
let d = 250;
|
|
this.elementRef.nativeElement.parentElement.animate({
|
|
transform: ['none', translate]
|
|
}, {
|
|
fill: 'forwards',
|
|
duration: d,
|
|
iterations: 1,
|
|
easing: 'ease-in-out'
|
|
});
|
|
setTimeout(() => {
|
|
this.onClose.emit(this.cardItem);
|
|
}, d);
|
|
}
|
|
}
|