fix(actionSheet): action sheet icons

This commit is contained in:
Adam Bradley
2015-12-31 20:47:12 -06:00
parent 5c43f7bc35
commit a63b5044df
5 changed files with 37 additions and 26 deletions

View File

@ -12,9 +12,9 @@ import {Animation} from '../../animations/animation';
* @name ActionSheet
* @description
* The Action Sheet is a slide-up dialog that lets the user choose from a set
* of options. Dangerous options are made obvious. There are easy ways to
* cancel out of the action sheet, such as tapping the backdrop or even hitting
* escape key on desktop.
* of options. Dangerous (destructive) options are made obvious. There are easy
* ways to cancel out of the action sheet, such as tapping the backdrop or
* hitting the escape key on desktop.
*
* @usage
* ```ts
@ -116,7 +116,7 @@ class ActionSheetCmp {
}
dismiss() {
this._viewCtrl.dismiss(this);
this._viewCtrl.dismiss();
}
onPageLoaded() {
@ -129,10 +129,16 @@ class ActionSheetCmp {
}
if (button.style === 'cancel') {
if (!button.icon) {
button.icon = this._config.get('actionSheetCancelIcon');
}
this.d.cancelButton = button;
} else {
if (button.style === 'destructive') {
if (!button.icon) {
button.icon = this._config.get('actionSheetDestructiveIcon');
}
button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-destructive';
}
buttons.push(button);

View File

@ -14,13 +14,14 @@ class E2EPage {
this.result = '';
let actionSheet = ActionSheet.create({
title: 'Modify your album',
buttons: [
{
text: 'Cancel',
style: 'cancel', // will always sort to be on the bottom
text: 'Destructive',
style: 'destructive',
handler: () => {
console.log('cancel this clicked');
this.result = 'Canceled';
console.log('Destructive clicked');
this.result = 'Destructive';
}
},
{
@ -40,11 +41,11 @@ class E2EPage {
}
},
{
text: 'Destructive',
style: 'destructive',
text: 'Cancel',
style: 'cancel', // will always sort to be on the bottom
handler: () => {
console.log('Destructive clicked');
this.result = 'Destructive';
console.log('cancel this clicked');
this.result = 'Canceled';
}
}
]
@ -58,14 +59,6 @@ class E2EPage {
let actionSheet = ActionSheet.create({
buttons: [
{
text: 'Destructive',
style: 'destructive',
handler: () => {
console.log('Destructive clicked');
this.result = 'Destructive';
}
},
{
text: 'Archive',
handler: () => {
@ -80,6 +73,14 @@ class E2EPage {
console.log('cancel this clicked');
this.result = 'Canceled';
}
},
{
text: 'Destructive',
style: 'destructive',
handler: () => {
console.log('Destructive clicked');
this.result = 'Destructive';
}
}
]
});

View File

@ -111,7 +111,7 @@ class AlertCmp {
}
dismiss() {
this._viewCtrl.dismiss(this);
this._viewCtrl.dismiss(this.getValues());
}
getValues() {

View File

@ -86,6 +86,10 @@ class E2EPage {
this.nav.present(alert).then(() => {
this.testPromptOpen = true;
});
alert.onDismiss(data => {
console.log('onDismiss data', data);
});
}
}

View File

@ -45,6 +45,11 @@ export class ViewController {
this._onDismiss = callback;
}
dismiss(data) {
this._onDismiss && this._onDismiss(data);
return this._nav.remove(this._nav.indexOf(this), this._leavingOpts);
}
setNav(navCtrl) {
this._nav = navCtrl;
}
@ -57,11 +62,6 @@ export class ViewController {
return new NavParams(this.data);
}
dismiss(data) {
this._onDismiss && this._onDismiss(data);
return this._nav.remove(this._nav.indexOf(this), this._leavingOpts);
}
setLeavingOpts(opts) {
this._leavingOpts = opts;
}