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

View File

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

View File

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

View File

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

View File

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