toolbar updates

This commit is contained in:
Adam Bradley
2015-07-03 23:56:47 -05:00
parent 5c4741b7b4
commit 3dbf489fc9
10 changed files with 110 additions and 158 deletions

View File

@ -46,39 +46,6 @@ ion-app,
} }
@-webkit-keyframes rotation {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(359deg);
}
}
@keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
ion-loading-icon {
display: flex;
align-self: center;
margin: auto;
font-family: 'Ionicons';
&:before {
content: "\f44e";
}
font-size: 128px;
color: #666666;
animation: rotation 45s infinite linear;
-webkit-animation: rotation 45s infinite linear;
}
ion-nav { ion-nav {
height: 100%; height: 100%;
} }
@ -115,9 +82,3 @@ ion-pane {
flex: 1; flex: 1;
order: $flex-order-view-content; order: $flex-order-view-content;
} }
ion-toolbar {
display: flex;
min-height: 4.4rem;
background: white;
}

View File

@ -124,3 +124,30 @@ $swipe-handle-bottom: 70px !default;
transform: translate3d(0px, 0px, 0px); transform: translate3d(0px, 0px, 0px);
} }
} }
// Loading Icon
// --------------------------------------------------
@keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
ion-loading-icon {
display: flex;
align-self: center;
margin: auto;
font-family: 'Ionicons';
&:before {
content: "\f44e";
}
font-size: 128px;
color: #666666;
animation: rotation 45s infinite linear;
}

View File

@ -9,7 +9,11 @@ $item-ios-accessory-color: #8e8e93 !default;
$item-ios-border-color: $list-ios-border-color !default; $item-ios-border-color: $list-ios-border-color !default;
.item.item-ios { .list-ios {
margin-top: -1px;
}
.list-ios .item {
background: $item-ios-background-color; background: $item-ios-background-color;
min-height: $item-ios-min-height; min-height: $item-ios-min-height;
padding-left: $item-ios-padding-left; padding-left: $item-ios-padding-left;

View File

@ -6,7 +6,10 @@ import {dom} from 'ionic/util';
@Component({ @Component({
selector: 'ion-item' selector: 'ion-item',
host: {
'class': 'item'
}
}) })
@View({ @View({
template: ` template: `

View File

@ -1,5 +1,6 @@
import {ElementRef, onInit} from 'angular2/angular2'; import {ElementRef, onInit} from 'angular2/angular2';
import {Ion} from '../ion';
import {IonicDirective} from '../../config/annotations'; import {IonicDirective} from '../../config/annotations';
import {ListVirtualScroll} from './virtual'; import {ListVirtualScroll} from './virtual';
import * as util from 'ionic/util'; import * as util from 'ionic/util';
@ -13,13 +14,15 @@ import * as util from 'ionic/util';
'content' 'content'
] ]
}) })
export class List { export class List extends Ion {
constructor(elementRef: ElementRef) { constructor(elementRef: ElementRef) {
super(elementRef);
this.ele = elementRef.nativeElement; this.ele = elementRef.nativeElement;
} }
onInit() { onInit() {
if(util.isDefined(this.virtual)) { List.applyConfig(this);
if (util.isDefined(this.virtual)) {
console.log('Content', this.content); console.log('Content', this.content);
console.log('Virtual?', this.virtual); console.log('Virtual?', this.virtual);
console.log('Items?', this.items.length, 'of \'em'); console.log('Items?', this.items.length, 'of \'em');

View File

@ -2,25 +2,10 @@
// Navbar // Navbar
// -------------------------------------------------- // --------------------------------------------------
$navbar-order: (
back-button: 10,
title: 20,
primary: 30,
secondary: 40
);
ion-navbar { ion-navbar {
@extend ion-toolbar;
position: absolute; position: absolute;
width: 100%;
height: 100%;
min-height: 4.4rem;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
order: $flex-order-toolbar-top;
transform: translate3d(100%, 0px, 0px); transform: translate3d(100%, 0px, 0px);
&.show-navbar { &.show-navbar {
@ -28,13 +13,8 @@ ion-navbar {
} }
} }
.navbar-inner {
display: flex;
width: 100%;
}
.back-button { .back-button {
order: map-get($navbar-order, 'back-button'); order: 10;
transform: translateZ(0px); transform: translateZ(0px);
display: none; display: none;
@ -47,43 +27,3 @@ ion-navbar {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.navbar-title {
flex: 1;
order: map-get($navbar-order, 'title');
display: flex;
align-items: center;
transform: translateZ(0px);
}
.navbar-inner-title {
width: 100%;
padding: 0 15px;
}
ion-title {
display: block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.navbar-item {
transform: translateZ(0px);
}
.navbar-primary-item {
order: map-get($navbar-order, 'primary');
}
.navbar-secondary-item {
order: map-get($navbar-order, 'secondary');
}
.navbar button,
.navbar [button] {
background: transparent;
border: none;
}

View File

@ -1,16 +1,18 @@
import {Component, Directive, View, Parent, ElementRef, forwardRef} from 'angular2/angular2'; import {Component, Directive, View, Parent, ElementRef, forwardRef} from 'angular2/angular2';
import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref'; import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
import {Ion} from '../ion';
import {IonicComponent} from '../../config/annotations';
import {ViewItem} from '../view/view-item'; import {ViewItem} from '../view/view-item';
import * as dom from '../../util/dom'; import * as dom from '../../util/dom';
@Component({ @IonicComponent({
selector: 'ion-navbar' selector: 'ion-navbar'
}) })
@View({ @View({
template: ` template: `
<div class="navbar-inner"> <div class="toolbar-inner">
<button class="back-button button"> <button class="back-button button">
<icon class="back-button-icon ion-ios-arrow-back"></icon> <icon class="back-button-icon ion-ios-arrow-back"></icon>
<span class="back-button-text"> <span class="back-button-text">
@ -18,15 +20,15 @@ import * as dom from '../../util/dom';
<span class="back-title" [inner-text]="bbText"></span> <span class="back-title" [inner-text]="bbText"></span>
</span> </span>
</button> </button>
<div class="navbar-title"> <div class="toolbar-title">
<div class="navbar-inner-title"> <div class="toolbar-inner-title">
<content select="ion-title"></content> <content select="ion-title"></content>
</div> </div>
</div> </div>
<div class="navbar-item navbar-primary-item"> <div class="toolbar-item toolbar-primary-item">
<content select="[primary]"></content> <content select="[primary]"></content>
</div> </div>
<div class="navbar-item navbar-secondary-item"> <div class="toolbar-item toolbar-secondary-item">
<content select="[secondary]"></content> <content select="[secondary]"></content>
</div> </div>
</div> </div>
@ -38,8 +40,9 @@ import * as dom from '../../util/dom';
forwardRef(() => NavbarItem) forwardRef(() => NavbarItem)
] ]
}) })
export class Navbar { export class Navbar extends Ion {
constructor(item: ViewItem, elementRef: ElementRef) { constructor(item: ViewItem, elementRef: ElementRef) {
super(elementRef);
this.eleRef = elementRef; this.eleRef = elementRef;
this.itemEles = []; this.itemEles = [];
item.navbarView(this); item.navbarView(this);
@ -48,6 +51,10 @@ export class Navbar {
this.bbText = ''; this.bbText = '';
} }
onInit() {
Navbar.applyConfig(this);
}
element() { element() {
return this.eleRef; return this.eleRef;
} }
@ -90,8 +97,8 @@ export class Navbar {
alignTitle() { alignTitle() {
// called after the navbar/title has had a moment to // called after the navbar/title has had a moment to
// finish rendering in their correct locations // finish rendering in their correct locations
const navbarEle = this.eleRef.nativeElement; const toolbarEle = this.eleRef.nativeElement;
const titleEle = this._ttEle || (this._ttEle = navbarEle.querySelector('ion-title')); const titleEle = this._ttEle || (this._ttEle = toolbarEle.querySelector('ion-title'));
// don't bother if there's no title element // don't bother if there's no title element
if (!titleEle) return; if (!titleEle) return;
@ -104,7 +111,7 @@ export class Navbar {
// get all the dimensions // get all the dimensions
const titleOffsetLeft = titleEle.offsetLeft; const titleOffsetLeft = titleEle.offsetLeft;
const titleOffsetRight = navbarEle.offsetWidth - (titleOffsetLeft + titleEle.offsetWidth); const titleOffsetRight = toolbarEle.offsetWidth - (titleOffsetLeft + titleEle.offsetWidth);
let marginLeft = 0; let marginLeft = 0;
let marginRight = 0; let marginRight = 0;
@ -119,7 +126,7 @@ export class Navbar {
if ((marginLeft || marginRight) && margin !== this._ttMargin) { if ((marginLeft || marginRight) && margin !== this._ttMargin) {
// only do an update if it has to // only do an update if it has to
const innerTitleEle = this._innerTtEle || (this._innerTtEle = navbarEle.querySelector('.navbar-inner-title')); const innerTitleEle = this._innerTtEle || (this._innerTtEle = toolbarEle.querySelector('.toolbar-inner-title'));
innerTitleEle.style.margin = this._ttMargin = margin; innerTitleEle.style.margin = this._ttMargin = margin;
} }
} }
@ -161,20 +168,20 @@ class BackButtonText {
} }
@Directive({ @Directive({
selector: '.navbar-title' selector: '.toolbar-title'
}) })
class Title { class Title {
constructor(@Parent() navbar: Navbar, elementRef: ElementRef) { constructor(@Parent() toolbar: Navbar, elementRef: ElementRef) {
navbar.titleElement(elementRef); toolbar.titleElement(elementRef);
} }
} }
@Directive({ @Directive({
selector: '.navbar-item' selector: '.toolbar-item'
}) })
class NavbarItem { class NavbarItem {
constructor(@Parent() navbar: Navbar, elementRef: ElementRef) { constructor(@Parent() toolbar: Navbar, elementRef: ElementRef) {
navbar.itemElements(elementRef); toolbar.itemElements(elementRef);
} }
} }

View File

@ -54,8 +54,8 @@ export class Refresher {
this.scrollChild = sc; this.scrollChild = sc;
this._touchMoveListener = this._handleTouchMove.bind(this); this._touchMoveListener = this._handleTouchMove.bind(this);
this._touchEndListener = this._handleTouchEnd.bind(this)); this._touchEndListener = this._handleTouchEnd.bind(this);
this._handleScrollListener = this._handleScroll.bind(this)); this._handleScrollListener = this._handleScroll.bind(this);
sc.addEventListener('touchmove', this._touchMoveListener); sc.addEventListener('touchmove', this._touchMoveListener);
sc.addEventListener('touchend', this._touchEndListener); sc.addEventListener('touchend', this._touchEndListener);
sc.addEventListener('scroll', this._handleScrollListener); sc.addEventListener('scroll', this._handleScrollListener);

View File

@ -1,5 +1,5 @@
// Navbar // Toolbar
// -------------------------------------------------- // --------------------------------------------------
$toolbar-order: ( $toolbar-order: (
@ -10,14 +10,20 @@ $toolbar-order: (
ion-toolbar { ion-toolbar {
position: relative;
width: 100%;
height: 100%;
min-height: 4.4rem;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
position: relative; order: $flex-order-toolbar-top;
} }
.toolbar-inner { .toolbar-inner {
display: flex;
width: 100%; width: 100%;
} }
@ -27,7 +33,24 @@ ion-toolbar {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 0 0 2px;
transform: translateZ(0px);
}
.toolbar-inner-title {
width: 100%;
padding: 0 15px;
}
ion-title {
display: block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.toolbar-item {
transform: translateZ(0px);
} }
.toolbar-primary-item { .toolbar-primary-item {
@ -38,24 +61,8 @@ ion-toolbar {
order: map-get($toolbar-order, 'secondary'); order: map-get($toolbar-order, 'secondary');
} }
ion-toolbar ion-title {
display: block;
overflow: hidden;
}
.toolbar-inner-title {
width: 100%;
padding: 0 15px;
white-space: nowrap;
text-overflow: ellipsis;
}
.toolbar button, .toolbar button,
.toolbar [button] { .toolbar [button] {
background: transparent; background: transparent;
border: none; border: none;
} }
.toolbar-title-hide {
opacity: 0;
}

View File

@ -10,23 +10,23 @@ import * as dom from '../../util/dom';
}) })
@View({ @View({
template: ` template: `
<div class="navbar-inner"> <div class="toolbar-inner">
<div class="navbar-title"> <div class="toolbar-title">
<div class="navbar-inner-title"> <div class="toolbar-inner-title">
<content select="ion-title"></content> <content select="ion-title"></content>
</div> </div>
</div> </div>
<div class="navbar-item navbar-primary-item"> <div class="toolbar-item toolbar-primary-item">
<content select="[primary]"></content> <content select="[primary]"></content>
</div> </div>
<div class="navbar-item navbar-secondary-item"> <div class="toolbar-item toolbar-secondary-item">
<content select="[secondary]"></content> <content select="[secondary]"></content>
</div> </div>
</div> </div>
`, `,
directives: [ directives: [
forwardRef(() => Title), forwardRef(() => ToolbarTitle),
forwardRef(() => NavbarItem) forwardRef(() => ToolbarItem)
] ]
}) })
export class Toolbar extends Ion { export class Toolbar extends Ion {
@ -68,8 +68,8 @@ export class Toolbar extends Ion {
alignTitle() { alignTitle() {
// called after the navbar/title has had a moment to // called after the navbar/title has had a moment to
// finish rendering in their correct locations // finish rendering in their correct locations
const navbarEle = this.eleRef.nativeElement; const toolbarEle = this.eleRef.nativeElement;
const titleEle = this._ttEle || (this._ttEle = navbarEle.querySelector('ion-title')); const titleEle = this._ttEle || (this._ttEle = toolbarEle.querySelector('ion-title'));
// don't bother if there's no title element // don't bother if there's no title element
if (!titleEle) return; if (!titleEle) return;
@ -82,7 +82,7 @@ export class Toolbar extends Ion {
// get all the dimensions // get all the dimensions
const titleOffsetLeft = titleEle.offsetLeft; const titleOffsetLeft = titleEle.offsetLeft;
const titleOffsetRight = navbarEle.offsetWidth - (titleOffsetLeft + titleEle.offsetWidth); const titleOffsetRight = toolbarEle.offsetWidth - (titleOffsetLeft + titleEle.offsetWidth);
let marginLeft = 0; let marginLeft = 0;
let marginRight = 0; let marginRight = 0;
@ -97,7 +97,7 @@ export class Toolbar extends Ion {
if ((marginLeft || marginRight) && margin !== this._ttMargin) { if ((marginLeft || marginRight) && margin !== this._ttMargin) {
// only do an update if it has to // only do an update if it has to
const innerTitleEle = this._innerTtEle || (this._innerTtEle = navbarEle.querySelector('.navbar-inner-title')); const innerTitleEle = this._innerTtEle || (this._innerTtEle = toolbarEle.querySelector('.toolbar-inner-title'));
innerTitleEle.style.margin = this._ttMargin = margin; innerTitleEle.style.margin = this._ttMargin = margin;
} }
} }
@ -106,9 +106,9 @@ export class Toolbar extends Ion {
@Directive({ @Directive({
selector: '.navbar-title' selector: '.toolbar-title'
}) })
class Title { class ToolbarTitle {
constructor(@Parent() toolbar: Toolbar, elementRef: ElementRef) { constructor(@Parent() toolbar: Toolbar, elementRef: ElementRef) {
toolbar.titleElement(elementRef); toolbar.titleElement(elementRef);
} }
@ -116,9 +116,9 @@ class Title {
@Directive({ @Directive({
selector: '.navbar-item' selector: '.toolbar-item'
}) })
class NavbarItem { class ToolbarItem {
constructor(@Parent() toolbar: Toolbar, elementRef: ElementRef) { constructor(@Parent() toolbar: Toolbar, elementRef: ElementRef) {
toolbar.itemElements(elementRef); toolbar.itemElements(elementRef);
} }