diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 83bd41965..34e1a1ab2 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -8,9 +8,10 @@ -
+
+
@@ -54,8 +55,8 @@
- -
+ +
diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index eb1e4c683..ecbbf27fa 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -1,7 +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 { Router } from '@angular/router'; +import { ProfileComponent } from '../headers/header-no-search/profile/profile.component'; @Component({ selector: 'app-header', @@ -12,8 +13,9 @@ export class HeaderPage implements OnInit { profile: string = 'mdgpr'; - constructor(private modalController: ModalController, - private router: Router) { + constructor( + private router: Router,private modalController: ModalController, + private animationController: AnimationController,) { window['header'] = (profile:string) => { this.profile = profile; @@ -41,4 +43,45 @@ export class HeaderPage implements OnInit { changeRoute(path){ this.router.navigateByUrl(path) } -} \ No newline at end of file + + + + async openProfile() { + + 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({ + enterAnimation, + leaveAnimation, + component: ProfileComponent, + cssClass: 'model profile-modal', + componentProps: { + } + }); + return await modal.present(); + } + +} + diff --git a/src/app/shared/headers/header-no-search/header-no-search.page.html b/src/app/shared/headers/header-no-search/header-no-search.page.html index cbb970246..d28efc73d 100644 --- a/src/app/shared/headers/header-no-search/header-no-search.page.html +++ b/src/app/shared/headers/header-no-search/header-no-search.page.html @@ -8,7 +8,8 @@ -
+ +
@@ -54,7 +55,7 @@
--> -
+
diff --git a/src/app/shared/headers/header-no-search/header-no-search.page.ts b/src/app/shared/headers/header-no-search/header-no-search.page.ts index dc81a7b90..2eb9191cc 100644 --- a/src/app/shared/headers/header-no-search/header-no-search.page.ts +++ b/src/app/shared/headers/header-no-search/header-no-search.page.ts @@ -19,7 +19,7 @@ export class HeaderNoSearchPage implements OnInit { ngOnInit() { } - async openSearch() { + async openProfile() { const enterAnimation = (baseEl: any) => { const backdropAnimation = this.animationController.create()