Styling some of the popups more - mostly MD mode. References #183

This commit is contained in:
Brandy Carney
2015-09-30 15:05:35 -04:00
parent 3042e7e9d0
commit 3d36cc6e07
5 changed files with 79 additions and 38 deletions

View File

@ -39,10 +39,6 @@ ion-popup {
color: $popup-ios-body-text-color; color: $popup-ios-body-text-color;
} }
.popup-body:empty {
padding: 0;
}
.popup-buttons { .popup-buttons {
padding: 0; padding: 0;
min-height: 0; min-height: 0;

View File

@ -14,6 +14,8 @@ $popup-md-body-text-color: rgba(0,0,0,.5) !default;
$popup-md-button-text-color: color(primary) !default; $popup-md-button-text-color: color(primary) !default;
$popup-md-button-min-height: 36px !default; $popup-md-button-min-height: 36px !default;
$popup-md-prompt-input-highlight-color: map-get($colors, primary) !default;
$popup-md-prompt-input-placeholder-color: #b9b9b9;
ion-popup { ion-popup {
@ -42,8 +44,28 @@ ion-popup {
color: $popup-md-body-text-color; color: $popup-md-body-text-color;
} }
.popup-body:empty { .prompt-input {
padding: 0; border-bottom: 1px solid #dedede;
&::-webkit-input-placeholder {
color: $popup-md-prompt-input-placeholder-color;
}
&:-moz-placeholder { /* Firefox 18- */
color: $popup-md-prompt-input-placeholder-color;
}
&::-moz-placeholder { /* Firefox 19+ */
color: $popup-md-prompt-input-placeholder-color;
}
&:-ms-input-placeholder {
color: $popup-md-prompt-input-placeholder-color;
}
&:focus {
border-bottom: 2px solid $popup-md-prompt-input-highlight-color;
}
} }
.popup-buttons { .popup-buttons {
@ -63,9 +85,5 @@ ion-popup {
box-shadow: none; box-shadow: none;
-webkit-transition: none; -webkit-transition: none;
transition: none; transition: none;
&:last-child {
margin-right: 0;
}
} }
} }

View File

@ -6,7 +6,7 @@ $popup-min-width: 250px !default;
$popup-max-width: 100% !default; $popup-max-width: 100% !default;
$popup-max-height: 90% !default; $popup-max-height: 90% !default;
$popup-sub-title-font-size: 11px !default; $popup-sub-title-font-size: 15px !default;
$popup-button-line-height: 20px !default; $popup-button-line-height: 20px !default;
$popup-button-font-size: 14px !default; $popup-button-font-size: 14px !default;
@ -59,6 +59,18 @@ ion-popup {
.popup-body { .popup-body {
overflow: auto; overflow: auto;
// TODO is this needed?
&:empty {
padding: 0;
}
}
.prompt-input {
border: 0;
background: inherit;
padding: 10px 0;
margin: 5px 0;
} }
.popup-buttons { .popup-buttons {
@ -72,9 +84,5 @@ ion-popup {
line-height: $popup-button-line-height; line-height: $popup-button-line-height;
font-size: $popup-button-font-size; font-size: $popup-button-font-size;
margin-right: $popup-button-margin-right; margin-right: $popup-button-margin-right;
&:last-child {
margin-right: 0;
}
} }
} }

View File

@ -3,6 +3,8 @@ import {FORM_DIRECTIVES, NgControl, NgControlGroup,
import {Overlay} from '../overlay/overlay'; import {Overlay} from '../overlay/overlay';
import {Animation} from '../../animations/animation'; import {Animation} from '../../animations/animation';
import {Ion} from '../ion';
import {IonInput} from '../form/input';
import * as util from 'ionic/util'; import * as util from 'ionic/util';
@ -81,7 +83,7 @@ export class Popup extends Overlay {
}; };
} }
let button = { let button = {
text: 'OK', text: context.okText || 'OK',
onTap: (event, popupRef) => { onTap: (event, popupRef) => {
// Allow it to close // Allow it to close
//resolve(); //resolve();
@ -112,13 +114,13 @@ export class Popup extends Overlay {
} }
} }
let okButton = { let okButton = {
text: 'OK', text: context.okText || 'OK',
onTap: (event, popupRef) => { onTap: (event, popupRef) => {
// Allow it to close // Allow it to close
} }
} }
let cancelButton = { let cancelButton = {
text: 'Cancel', text: context.cancelText || 'Cancel',
isCancel: true, isCancel: true,
onTap: (event, popupRef) => { onTap: (event, popupRef) => {
// Allow it to close // Allow it to close
@ -146,16 +148,17 @@ export class Popup extends Overlay {
title: context title: context
}; };
} }
let okButton = { let okButton = {
text: 'Ok', text: context.okText || 'OK',
type: context.okType,
onTap: (event, popupRef) => { onTap: (event, popupRef) => {
// Allow it to close // Allow it to close
} }
} }
let cancelButton = { let cancelButton = {
text: 'Cancel', text: context.cancelText || 'Cancel',
type: context.cancelType,
isCancel: true, isCancel: true,
onTap: (event, popupRef) => { onTap: (event, popupRef) => {
// Allow it to close // Allow it to close
@ -201,14 +204,15 @@ const OVERLAY_TYPE = 'popup';
'<backdrop (click)="_cancel($event)" tappable disable-activated></backdrop>' + '<backdrop (click)="_cancel($event)" tappable disable-activated></backdrop>' +
'<popup-wrapper>' + '<popup-wrapper>' +
'<div class="popup-head">' + '<div class="popup-head">' +
'<h3 class="popup-title" [inner-html]="title"></h3>' + '<h2 class="popup-title" [inner-html]="title" *ng-if="title"></h2>' +
'<h5 class="popup-sub-title" [inner-html]="subTitle" *ng-if="subTitle"></h5>' + '<h3 class="popup-sub-title" [inner-html]="subTitle" *ng-if="subTitle"></h3>' +
'</div>' + '</div>' +
'<div class="popup-body">' + '<div class="popup-body">' +
'<input type="text" *ng-if="showPrompt" placeholder="{{promptPlaceholder}}">' + '<div [inner-html]="template" *ng-if="template"></div>' +
'<input type="{{inputType || \'text\'}}" placeholder="{{inputPlaceholder}}" *ng-if="showPrompt" class="prompt-input">' +
'</div>' + '</div>' +
'<div class="popup-buttons" *ng-if="buttons.length">' + '<div class="popup-buttons" *ng-if="buttons.length">' +
'<button *ng-for="#button of buttons" (click)="buttonTapped(button, $event)" [ng-class]="button.type || \'button-default\'" [inner-html]="button.text"></button>' + '<button *ng-for="#button of buttons" (click)="buttonTapped(button, $event)" [inner-html]="button.text"></button>' +
'</div>' + '</div>' +
'</popup-wrapper>', '</popup-wrapper>',
directives: [FORM_DIRECTIVES, NgClass, NgIf, NgFor] directives: [FORM_DIRECTIVES, NgClass, NgIf, NgFor]

View File

@ -17,14 +17,23 @@ class E2EApp {
doAlert() { doAlert() {
this.alertOpen = true; this.alertOpen = true;
this.popup.alert('Alert').then(() => { this.popup.alert({
title: "New Friend!",
template: "Your friend, Obi wan Kenobi, just accepted your friend request!"
}).then(() => {
this.alertOpen = false; this.alertOpen = false;
}); });
} }
doPrompt() { doPrompt() {
this.promptOpen = true; this.promptOpen = true;
this.popup.prompt('What is your name?').then((name) => { this.popup.prompt({
title: "New Album",
template: "Enter a name for this new album you're so keen on adding",
inputPlaceholder: "Title",
okText: "Save",
okType: "secondary"
}).then((name) => {
this.promptResult = name; this.promptResult = name;
this.promptOpen = false; this.promptOpen = false;
}, () => { }, () => {
@ -35,7 +44,13 @@ class E2EApp {
doConfirm() { doConfirm() {
this.confirmOpen = true; this.confirmOpen = true;
this.popup.confirm('Are you sure?').then((result, ev) => { this.popup.confirm({
title: "Use this lightsaber?",
subTitle: "You can't exchange lightsabers",
template: "Do you agree to use this lightsaber to do good across the intergalactic galaxy?",
cancelText: "Disagree",
okText: "Agree"
}).then((result, ev) => {
console.log('CONFIRMED', result); console.log('CONFIRMED', result);
this.confirmResult = result; this.confirmResult = result;
this.confirmOpen = false; this.confirmOpen = false;