mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
fix(action-sheet): fix button positioning, backdrop opacity
This commit is contained in:
committed by
mhartington
parent
7331bf499f
commit
4ce01761bb
@ -61,6 +61,18 @@ $action-sheet-ios-button-text-color: #007aff !default;
|
|||||||
/// @prop - Fill color of the action sheet button icon
|
/// @prop - Fill color of the action sheet button icon
|
||||||
$action-sheet-ios-button-icon-fill-color: $action-sheet-ios-button-text-color !default;
|
$action-sheet-ios-button-icon-fill-color: $action-sheet-ios-button-text-color !default;
|
||||||
|
|
||||||
|
/// @prop - Font size of the action sheet button icon
|
||||||
|
$action-sheet-ios-button-icon-font-size: 1.4em !default;
|
||||||
|
|
||||||
|
/// @prop - Padding right of the action sheet button icon
|
||||||
|
$action-sheet-ios-button-icon-padding-right: 0.1em !default;
|
||||||
|
|
||||||
|
/// @prop - Height of the action sheet button icon
|
||||||
|
$action-sheet-ios-button-icon-height: .7em !default;
|
||||||
|
|
||||||
|
/// @prop - Margin top of the action sheet button icon
|
||||||
|
$action-sheet-ios-button-icon-margin-top: -10px !default;
|
||||||
|
|
||||||
/// @prop - Font size of the action sheet button
|
/// @prop - Font size of the action sheet button
|
||||||
$action-sheet-ios-button-font-size: 2rem !default;
|
$action-sheet-ios-button-font-size: 2rem !default;
|
||||||
|
|
||||||
@ -138,8 +150,12 @@ $action-sheet-ios-button-cancel-font-weight: 600 !default;
|
|||||||
background: $action-sheet-ios-button-background;
|
background: $action-sheet-ios-button-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-sheet-ios .action-sheet-button {
|
.action-sheet-ios .action-sheet-button .action-sheet-icon {
|
||||||
fill: $action-sheet-ios-button-icon-fill-color;
|
fill: $action-sheet-ios-button-icon-fill-color;
|
||||||
|
font-size: $action-sheet-ios-button-icon-font-size;
|
||||||
|
padding-right: $action-sheet-ios-button-icon-padding-right;
|
||||||
|
height: $action-sheet-ios-button-icon-height;
|
||||||
|
margin-top: $action-sheet-ios-button-icon-margin-top;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-sheet-ios .action-sheet-button:last-child {
|
.action-sheet-ios .action-sheet-button:last-child {
|
||||||
|
|||||||
@ -179,10 +179,12 @@ export class ActionSheet {
|
|||||||
: null}
|
: null}
|
||||||
{buttons.map(b =>
|
{buttons.map(b =>
|
||||||
<button class={this.buttonClass(b)} onClick={() => this.click(b)}>
|
<button class={this.buttonClass(b)} onClick={() => this.click(b)}>
|
||||||
|
<span class="button-inner">
|
||||||
{b.icon
|
{b.icon
|
||||||
? <ion-icon name={b.icon} class="action-sheet-icon" />
|
? <ion-icon name={b.icon} class="action-sheet-icon" />
|
||||||
: null}
|
: null}
|
||||||
{b.text}
|
{b.text}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Animation } from '../../../index';
|
import { Animation } from '../../../index';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iOS Loading Enter Animation
|
* iOS Action Sheet Animation
|
||||||
*/
|
*/
|
||||||
export default function(Animation: Animation, baseElm: HTMLElement) {
|
export default function(Animation: Animation, baseElm: HTMLElement) {
|
||||||
const baseAnimation = new Animation();
|
const baseAnimation = new Animation();
|
||||||
@ -12,7 +12,7 @@ export default function(Animation: Animation, baseElm: HTMLElement) {
|
|||||||
const wrapperAnimation = new Animation();
|
const wrapperAnimation = new Animation();
|
||||||
wrapperAnimation.addElement(baseElm.querySelector('.action-sheet-wrapper'));
|
wrapperAnimation.addElement(baseElm.querySelector('.action-sheet-wrapper'));
|
||||||
|
|
||||||
backdropAnimation.fromTo('opacity', 0.01, 0.26);
|
backdropAnimation.fromTo('opacity', 0.01, 0.4);
|
||||||
|
|
||||||
wrapperAnimation.fromTo('translateY', '100%', '0%');
|
wrapperAnimation.fromTo('translateY', '100%', '0%');
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Animation } from '../../../index';
|
import { Animation } from '../../../index';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iOS Loading Leave Animation
|
* iOS Action Sheet Leave Animation
|
||||||
*/
|
*/
|
||||||
export default function(Animation: Animation, baseElm: HTMLElement) {
|
export default function(Animation: Animation, baseElm: HTMLElement) {
|
||||||
const baseAnimation = new Animation();
|
const baseAnimation = new Animation();
|
||||||
@ -12,7 +12,7 @@ export default function(Animation: Animation, baseElm: HTMLElement) {
|
|||||||
const wrapperAnimation = new Animation();
|
const wrapperAnimation = new Animation();
|
||||||
wrapperAnimation.addElement(baseElm.querySelector('.action-sheet-wrapper'));
|
wrapperAnimation.addElement(baseElm.querySelector('.action-sheet-wrapper'));
|
||||||
|
|
||||||
backdropAnimation.fromTo('opacity', 0.26, 0);
|
backdropAnimation.fromTo('opacity', 0.4, 0);
|
||||||
|
|
||||||
wrapperAnimation.fromTo('translateY', '0%', '100%');
|
wrapperAnimation.fromTo('translateY', '0%', '100%');
|
||||||
|
|
||||||
|
|||||||
@ -18,12 +18,15 @@
|
|||||||
|
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
<ion-button block onclick="presentActionSheet1()">Present Action Sheet 1</ion-button>
|
<ion-button block onclick="presentActionSheet1()">Present Action Sheet 1</ion-button>
|
||||||
|
<ion-button block onclick="presentActionSheet2()">Present Action Sheet 2</ion-button>
|
||||||
|
<ion-button block onclick="presentActionSheet3()">Present Action Sheet 3</ion-button>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-app>
|
</ion-app>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function presentActionSheet1() {
|
function presentActionSheet1() {
|
||||||
console.log('presenting');
|
var mode = Ionic.mode;
|
||||||
|
|
||||||
Ionic.controller('action-sheet', {
|
Ionic.controller('action-sheet', {
|
||||||
title: "Albums",
|
title: "Albums",
|
||||||
@ -48,9 +51,57 @@
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: 'Favorite',
|
text: 'Favorite',
|
||||||
|
icon: mode !== 'ios' ? 'heart' : null,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
console.log('Favorite clicked');
|
console.log('Favorite clicked');
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
text: 'Cancel',
|
||||||
|
role: 'cancel',
|
||||||
|
icon: mode !== 'ios' ? 'close' : null,
|
||||||
|
handler: () => {
|
||||||
|
console.log('Cancel clicked');
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
.then(actionSheet => {
|
||||||
|
actionSheet.present()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function presentActionSheet2() {
|
||||||
|
Ionic.controller('action-sheet', {
|
||||||
|
buttons: [{
|
||||||
|
text: 'Archive',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Archive clicked');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: 'Destructive',
|
||||||
|
role: 'destructive',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Destructive clicked');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: 'Cancel',
|
||||||
|
role: 'cancel',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Cancel clicked');
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
.then(actionSheet => {
|
||||||
|
actionSheet.present()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function presentActionSheet3() {
|
||||||
|
Ionic.controller('action-sheet', {
|
||||||
|
buttons: [{
|
||||||
|
text: 'Open Alert',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Open Alert clicked');
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
text: 'Cancel',
|
text: 'Cancel',
|
||||||
role: 'cancel',
|
role: 'cancel',
|
||||||
|
|||||||
Reference in New Issue
Block a user