Add profile modal

This commit is contained in:
2021-02-18 12:44:35 +01:00
parent edb5957cb2
commit 23f5e954c9
13 changed files with 245 additions and 25 deletions
@@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { AnimationController, ModalController } from '@ionic/angular';
import { SearchPage } from 'src/app/pages/search/search.page';
import { MenuController } from '@ionic/angular';
import { ProfileComponent } from './profile/profile.component';
@Component({
selector: 'app-header-no-search',
templateUrl: './header-no-search.page.html',
@@ -11,15 +11,43 @@ import { MenuController } from '@ionic/angular';
export class HeaderNoSearchPage implements OnInit {
constructor(private modalController: ModalController,
private menu: MenuController) { }
private menu: MenuController,
private animationController: AnimationController,) { }
ngOnInit() {
}
async openSearch() {
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');
}
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'group-messages',
enterAnimation,
leaveAnimation,
component: ProfileComponent,
cssClass: 'model profile-modal',
componentProps: {
}
});