From 093e62eb64c5446d13fd78ec68dd4e9d4ebfe684 Mon Sep 17 00:00:00 2001 From: TheDiaval Date: Fri, 4 Oct 2019 09:43:05 +0300 Subject: [PATCH] fix(theme-shared): fix modal styles and animations --- .../src/lib/animations/fade.animations.ts | 63 +++++++++---------- .../lib/components/modal/modal.animations.ts | 14 ++--- .../lib/components/modal/modal.component.html | 44 +++++++------ .../lib/components/modal/modal.component.ts | 20 +++--- .../theme-shared/src/lib/contants/styles.ts | 18 +++++- 5 files changed, 90 insertions(+), 69 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts index 7eb513522d..3321974a77 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/fade.animations.ts @@ -1,79 +1,74 @@ import { animate, animation, style } from '@angular/animations'; -export const fadeIn = animation( - [style({ opacity: '0', display: '{{ display }}' }), animate('{{ time}} {{ easing }}', style({ opacity: '1' }))], - { params: { time: '350ms', easing: 'ease', display: 'block' } } -); +export const fadeIn = animation([style({ opacity: '0' }), animate('{{ time}} {{ easing }}', style({ opacity: '1' }))], { + params: { time: '350ms', easing: 'ease' }, +}); export const fadeOut = animation( - [ - style({ opacity: '1' }), - animate('{{ time}} {{ easing }}', style({ opacity: '0' })), - style({ opacity: '0', display: 'none' }) - ], - { params: { time: '350ms', easing: 'ease' } } + [style({ opacity: '1' }), animate('{{ time}} {{ easing }}', style({ opacity: '0' }))], + { params: { time: '350ms', easing: 'ease' } }, ); export const fadeInDown = animation( [ - style({ opacity: '0', display: '{{ display }}', transform: '{{ transform }} translateY(-20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateY(0)' })) + style({ opacity: '0', transform: '{{ transform }} translateY(-20px)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateY(0)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); export const fadeInUp = animation( [ - style({ opacity: '0', display: '{{ display }}', transform: '{{ transform }} translateY(20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateY(0)' })) + style({ opacity: '0', transform: '{{ transform }} translateY(20px)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateY(0)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); export const fadeInLeft = animation( [ - style({ opacity: '0', display: '{{ display }}', transform: '{{ transform }} translateX(20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateX(0)' })) + style({ opacity: '0', transform: '{{ transform }} translateX(20px)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateX(0)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); export const fadeInRight = animation( [ - style({ opacity: '0', display: '{{ display }}', transform: '{{ transform }} translateX(-20px)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateX(0)' })) + style({ opacity: '0', transform: '{{ transform }} translateX(-20px)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '1', transform: '{{ transform }} translateX(0)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); export const fadeOutDown = animation( [ - style({ opacity: '1', display: '{{ display }}', transform: '{{ transform }} translateY(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateY(20px)' })) + style({ opacity: '1', transform: '{{ transform }} translateY(0)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateY(20px)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); export const fadeOutUp = animation( [ - style({ opacity: '1', display: '{{ display }}', transform: '{{ transform }} translateY(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateY(-20px)' })) + style({ opacity: '1', transform: '{{ transform }} translateY(0)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateY(-20px)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); export const fadeOutLeft = animation( [ - style({ opacity: '1', display: '{{ display }}', transform: '{{ transform }} translateX(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateX(20px)' })) + style({ opacity: '1', transform: '{{ transform }} translateX(0)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateX(20px)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); export const fadeOutRight = animation( [ - style({ opacity: '1', display: '{{ display }}', transform: '{{ transform }} translateX(0)' }), - animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateX(-20px)' })) + style({ opacity: '1', transform: '{{ transform }} translateX(0)' }), + animate('{{ time }} {{ easing }}', style({ opacity: '0', transform: '{{ transform }} translateX(-20px)' })), ], - { params: { time: '350ms', easing: 'ease', display: 'block', transform: 'translate(-50%, -50%)' } } + { params: { time: '350ms', easing: 'ease', transform: '' } }, ); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.animations.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.animations.ts index c686bec552..22513b0c6f 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.animations.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.animations.ts @@ -1,14 +1,12 @@ -import { trigger, state, style, transition, useAnimation } from '@angular/animations'; -import { fadeInDown, fadeOut, fadeIn } from '../../animations'; +import { transition, trigger, useAnimation } from '@angular/animations'; +import { fadeIn, fadeInDown, fadeOut } from '../../animations/fade.animations'; export const backdropAnimation = trigger('backdrop', [ - state('void', style({ opacity: '0' })), - state('*', style({ opacity: '1' })), - transition('void => *', useAnimation(fadeIn)), - transition('* => void', useAnimation(fadeOut)) + transition(':enter', useAnimation(fadeIn)), + transition(':leave', useAnimation(fadeOut)), ]); export const dialogAnimation = trigger('dialog', [ - transition('void => *', useAnimation(fadeInDown)), - transition('* => void', useAnimation(fadeOut)) + transition(':enter', useAnimation(fadeInDown)), + transition(':leave', useAnimation(fadeOut)), ]); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html index c6eb6bf839..96a43f4eff 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.html @@ -1,21 +1,29 @@ -