From e955c3a88ab7a5ef5e7eee7f7d2b66cee18f4ccd Mon Sep 17 00:00:00 2001 From: Drew Rygh Date: Tue, 6 Oct 2015 10:43:49 -0500 Subject: [PATCH] docs(demos): modal demo outline --- demos/component-docs/index.ts | 43 +++++++++++++++++++++--------- demos/component-docs/main.html | 8 ++++-- demos/component-docs/modal.html | 1 + demos/component-docs/modal.ts | 46 +++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 demos/component-docs/modal.html create mode 100644 demos/component-docs/modal.ts diff --git a/demos/component-docs/index.ts b/demos/component-docs/index.ts index 3308a6985e..14ff9d3315 100644 --- a/demos/component-docs/index.ts +++ b/demos/component-docs/index.ts @@ -1,20 +1,13 @@ import {App, IonicApp, ActionSheet, NavController, NavParams} from 'ionic/ionic'; -import {Modal, IonicView, IonicConfig, Events} from 'ionic/ionic'; +import {Modal, IonicView, IonicConfig, Events, Animation} from 'ionic/ionic'; import {NgZone} from 'angular2/angular2'; import {NavigationDetailsPage} from 'navigation'; import {TabsPage} from 'tabs'; +import {DemoModal} from 'modal'; import * as helpers from 'helpers'; -@IonicView({ - template: '
My Modal
' -}) -class DemoModal extends Modal { - constructor() { - super(); - } -} @IonicView({ @@ -37,6 +30,7 @@ export class MainPage { this.modal = modal; this.actionSheet = actionSheet; this.navDetailsPage = NavigationDetailsPage; + this.demoModal = DemoModal; if (params.data.location) { this.component.title = params.data.location; } else if (window.location.hash) { this.component.title = window.location.hash; } @@ -99,15 +93,40 @@ export class MainPage { // Modal // ************************** openModal() { - this.modal.open(DemoModal, { + this.modal.open(this.demoModal, { + handle: 'my-awesome-modal', enterAnimation: 'my-fade-in', - leaveAnimation: 'my-fade-out', - handle: 'my-awesome-modal' + leaveAnimation: 'my-fade-out' }); } } +class FadeIn extends Animation { + constructor(element) { + super(element); + this + .easing('ease') + .duration(450) + .fadeIn(); + } +} + +Animation.register('my-fade-in', FadeIn); + +class FadeOut extends Animation { + constructor(element) { + super(element); + this + .easing('ease') + .duration(250) + .fadeOut(); + } +} + +Animation.register('my-fade-out', FadeOut); + + @App({ template: '' }) diff --git a/demos/component-docs/main.html b/demos/component-docs/main.html index e7039e0bda..0a42ef51b9 100644 --- a/demos/component-docs/main.html +++ b/demos/component-docs/main.html @@ -354,8 +354,12 @@ -
- TODO + +
+ +