mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
refactor(demos): give each component section its own view
This commit is contained in:
13
demos/component-docs/modals/modals-content.html
Normal file
13
demos/component-docs/modals/modals-content.html
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
<ion-pane padding>
|
||||
<button block danger (click)="closeModal()">
|
||||
<icon close></icon>
|
||||
Close Modal
|
||||
</button>
|
||||
</ion-pane>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
14
demos/component-docs/modals/modals.html
Normal file
14
demos/component-docs/modals/modals.html
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
<ion-navbar *navbar class="show-navbar">
|
||||
<ion-title>Modals</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-content class="has-header padding">
|
||||
<button block (click)="openModal()">
|
||||
Show Modal
|
||||
</button>
|
||||
</ion-content>
|
||||
|
||||
|
||||
|
||||
|
80
demos/component-docs/modals/modals.ts
Normal file
80
demos/component-docs/modals/modals.ts
Normal file
@ -0,0 +1,80 @@
|
||||
import {App, IonicApp, Animation, Modal, NavController, IonicView, Events} from 'ionic/ionic';
|
||||
import * as helpers from 'helpers';
|
||||
|
||||
|
||||
@IonicView({
|
||||
templateUrl: 'modals/modals.html'
|
||||
})
|
||||
class ModalsFirstPage {
|
||||
|
||||
constructor(
|
||||
nav: NavController,
|
||||
modal: Modal,
|
||||
events: Events
|
||||
) {
|
||||
this.nav = nav;
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
openModal() {
|
||||
this.modal.open(ModalsContentPage, {
|
||||
handle: 'my-awesome-modal',
|
||||
enterAnimation: 'my-fade-in',
|
||||
leaveAnimation: 'my-fade-out'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IonicView({
|
||||
templateUrl: 'modals/modals-content.html'
|
||||
})
|
||||
class ModalsContentPage {
|
||||
|
||||
constructor(
|
||||
modal: Modal,
|
||||
events: Events
|
||||
) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
closeModal() {
|
||||
let modal = this.modal.get();
|
||||
if (modal) {
|
||||
modal.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IonicView({
|
||||
template: '<ion-nav [root]="rootView"></ion-nav>'
|
||||
})
|
||||
export class ModalsPage {
|
||||
constructor() {
|
||||
this.rootView = ModalsFirstPage;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
Reference in New Issue
Block a user