From dfa4555e2fdc48dc9ab61edb57a83f95b061e68c Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 2 Aug 2019 11:08:42 +0300 Subject: [PATCH] feature(theme): add route animation --- .../src/lib/components/layout/layout.component.html | 8 ++++++-- .../src/lib/components/layout/layout.component.ts | 2 ++ .../packages/theme-shared/src/lib/animations/index.ts | 1 + .../theme-shared/src/lib/animations/slide.animation.ts | 6 ++++++ npm/ng-packs/packages/theme-shared/src/public-api.ts | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts create mode 100644 npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animation.ts diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html b/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html index 969f41fa1c..0aebd0927b 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html @@ -8,8 +8,12 @@ -
- +
+
diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.ts b/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.ts index cc2113d31a..8e5fddcc46 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.ts @@ -1,8 +1,10 @@ import { Component } from '@angular/core'; +import { slideFromBottom } from '@abp/ng.theme.shared'; @Component({ selector: ' abp-layout', templateUrl: './layout.component.html', + animations: [slideFromBottom], }) export class LayoutComponent { isCollapsed: boolean = false; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts new file mode 100644 index 0000000000..6fd1d939c4 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts @@ -0,0 +1 @@ +export * from './slide.animation'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animation.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animation.ts new file mode 100644 index 0000000000..90f46662be --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animation.ts @@ -0,0 +1,6 @@ +import { animate, state, style, transition, trigger, query } from '@angular/animations'; +export const slideFromBottom = trigger('routeAnimations', [ + state('void', style({ 'margin-top': '20px', opacity: '0' })), + state('*', style({ 'margin-top': '0px', opacity: '1' })), + transition(':enter', [animate('0.2s ease-out', style({ opacity: '1', 'margin-top': '0px' }))]), +]); diff --git a/npm/ng-packs/packages/theme-shared/src/public-api.ts b/npm/ng-packs/packages/theme-shared/src/public-api.ts index b7f52bc3f0..6a9eae0f64 100644 --- a/npm/ng-packs/packages/theme-shared/src/public-api.ts +++ b/npm/ng-packs/packages/theme-shared/src/public-api.ts @@ -3,6 +3,7 @@ */ export * from './lib/theme-shared.module'; +export * from './lib/animations'; export * from './lib/components'; export * from './lib/models'; export * from './lib/services';