Files
doneit-web/src/app/shared/headers/header-no-search/header-no-search.page.ts
T

63 lines
1.8 KiB
TypeScript
Raw Normal View History

2021-01-29 11:28:26 +01:00
import { Component, OnInit } from '@angular/core';
2021-02-18 12:44:35 +01:00
import { AnimationController, ModalController } from '@ionic/angular';
2021-01-29 11:28:26 +01:00
import { SearchPage } from 'src/app/pages/search/search.page';
2021-02-12 16:56:26 +01:00
import { MenuController } from '@ionic/angular';
2021-02-18 12:44:35 +01:00
import { ProfileComponent } from './profile/profile.component';
2021-03-01 15:45:30 +01:00
import { Router } from '@angular/router';
2021-01-29 11:28:26 +01:00
@Component({
selector: 'app-header-no-search',
templateUrl: './header-no-search.page.html',
styleUrls: ['./header-no-search.page.scss'],
})
export class HeaderNoSearchPage implements OnInit {
2021-02-12 16:56:26 +01:00
constructor(private modalController: ModalController,
2021-02-18 12:44:35 +01:00
private menu: MenuController,
2021-03-01 15:45:30 +01:00
private animationController: AnimationController,
private router: Router) { }
2021-01-29 11:28:26 +01:00
ngOnInit() {
}
async openSearch() {
2021-02-18 12:44:35 +01:00
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
2021-01-29 11:28:26 +01:00
const modal = await this.modalController.create({
2021-02-18 12:44:35 +01:00
enterAnimation,
leaveAnimation,
component: ProfileComponent,
cssClass: 'model profile-modal',
2021-01-29 11:28:26 +01:00
componentProps: {
}
});
return await modal.present();
}
2021-03-01 15:45:30 +01:00
changeRoute(path){
this.router.navigateByUrl(path)
}
2021-01-29 11:28:26 +01:00
}