mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
iOS toolbar time
This commit is contained in:
@ -5,7 +5,6 @@
|
|||||||
$content-background-color: #fff !default;
|
$content-background-color: #fff !default;
|
||||||
|
|
||||||
|
|
||||||
.toolbar-container,
|
|
||||||
.nav-item-container {
|
.nav-item-container {
|
||||||
background-color: $content-background-color;
|
background-color: $content-background-color;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Parent, Ancestor} from 'angular2/src/core/annotations_impl/visibility';
|
import {Ancestor} from 'angular2/src/core/annotations_impl/visibility';
|
||||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||||
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||||
@ -6,7 +6,8 @@ import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
|||||||
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
|
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
|
||||||
import {Injector} from 'angular2/di';
|
import {Injector} from 'angular2/di';
|
||||||
|
|
||||||
import {NavBase} from 'ionic/components/nav/nav-base';
|
import {NavBase} from './nav-base';
|
||||||
|
import {ToolbarContainer} from '../toolbar/toolbar-container';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -18,13 +19,13 @@ import {NavBase} from 'ionic/components/nav/nav-base';
|
|||||||
@View({
|
@View({
|
||||||
template: `
|
template: `
|
||||||
<header class="toolbar-container">
|
<header class="toolbar-container">
|
||||||
<header-anchor></header-anchor>
|
<template header-anchor></template>
|
||||||
</header>
|
</header>
|
||||||
<section class="nav-item-container">
|
<section class="nav-item-container">
|
||||||
<content-anchor></content-anchor>
|
<template content-anchor></template>
|
||||||
</section>
|
</section>
|
||||||
`,
|
`,
|
||||||
directives: [HeaderAnchor, ContentAnchor]
|
directives: [HeaderAnchor, ContentAnchor, ToolbarContainer]
|
||||||
})
|
})
|
||||||
export class Nav extends NavBase {
|
export class Nav extends NavBase {
|
||||||
constructor(loader: DynamicComponentLoader, injector: Injector) {
|
constructor(loader: DynamicComponentLoader, injector: Injector) {
|
||||||
@ -33,8 +34,8 @@ export class Nav extends NavBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Directive({
|
||||||
selector: 'header-anchor'
|
selector: '[header-anchor]'
|
||||||
})
|
})
|
||||||
class HeaderAnchor {
|
class HeaderAnchor {
|
||||||
constructor(@Ancestor() nav: Nav, viewContainerRef: ViewContainerRef) {
|
constructor(@Ancestor() nav: Nav, viewContainerRef: ViewContainerRef) {
|
||||||
@ -43,8 +44,8 @@ class HeaderAnchor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Directive({
|
||||||
selector: 'content-anchor'
|
selector: '[content-anchor]'
|
||||||
})
|
})
|
||||||
class ContentAnchor {
|
class ContentAnchor {
|
||||||
constructor(@Ancestor() nav: Nav, elementRef: ElementRef) {
|
constructor(@Ancestor() nav: Nav, elementRef: ElementRef) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|
||||||
|
|
||||||
<ion-content class="padding" style="background:lightblue">
|
<ion-content class="padding">
|
||||||
|
|
||||||
<p>First Page: {{ val }}</p>
|
<p>First Page: {{ val }}</p>
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||||
|
|
||||||
import {NavController, Header, Toolbar} from 'ionic/ionic';
|
import {NavController, Header, Toolbar, ToolbarTitle} from 'ionic/ionic';
|
||||||
import {SecondPage} from './second-page';
|
import {SecondPage} from './second-page';
|
||||||
|
|
||||||
|
|
||||||
@Component({selector: 'ion-view'})
|
@Component({selector: 'ion-view'})
|
||||||
@View({
|
@View({
|
||||||
templateUrl: 'pages/first-page.html',
|
templateUrl: 'pages/first-page.html',
|
||||||
directives: [Header, Toolbar]
|
directives: [Header, Toolbar, ToolbarTitle]
|
||||||
})
|
})
|
||||||
export class FirstPage {
|
export class FirstPage {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|
||||||
|
|
||||||
<ion-content class="padding" style="background:green">
|
<ion-content class="padding">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<button (click)="pop()">Pop (Go back to 1st)</button>
|
<button (click)="pop()">Pop (Go back to 1st)</button>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|
||||||
|
|
||||||
<ion-content class="padding" style="background:yellow">
|
<ion-content class="padding">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<button (click)="pop()">Pop (Go back to 2nd)</button>
|
<button (click)="pop()">Pop (Go back to 2nd)</button>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
// iOS Toolbar
|
// iOS Toolbar
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
$toolbar-order-ios: (
|
$toolbar-order-ios: (
|
||||||
back-button: 1,
|
back-button: 1,
|
||||||
primary: 2,
|
primary: 2,
|
||||||
@ -18,17 +19,31 @@ $toolbar-ios-button-text-color: #007aff !default;
|
|||||||
$toolbar-ios-button-background-color: transparent !default;
|
$toolbar-ios-button-background-color: transparent !default;
|
||||||
|
|
||||||
|
|
||||||
.toolbar-ios {
|
.toolbar-container-ios {
|
||||||
height: $toolbar-ios-height;
|
height: $toolbar-ios-height;
|
||||||
background: $toolbar-ios-background;
|
background: $toolbar-ios-background;
|
||||||
|
|
||||||
|
// toolbar on top, border on bottom (default)
|
||||||
|
@include hairline(bottom, $toolbar-ios-border-color);
|
||||||
|
|
||||||
|
// toolbar on bottom, border on top
|
||||||
|
&.toolbar-bottom:after {
|
||||||
|
top: 0;
|
||||||
|
bottom: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.toolbar-ios {
|
||||||
|
|
||||||
.toolbar [side="primary"] {
|
.toolbar [side="primary"] {
|
||||||
@include flex-order(map-get($toolbar-order-ios, 'primary'));
|
@include flex-order(map-get($toolbar-order-ios, 'primary'));
|
||||||
}
|
}
|
||||||
.toolbar [side="secondary"] {
|
.toolbar [side="secondary"] {
|
||||||
@include flex-order(map-get($toolbar-order-ios, 'secondary'));
|
@include flex-order(map-get($toolbar-order-ios, 'secondary'));
|
||||||
}
|
}
|
||||||
.toolbar-title {
|
|
||||||
|
ion-title {
|
||||||
@include flex-order(map-get($toolbar-order-ios, 'title'));
|
@include flex-order(map-get($toolbar-order-ios, 'title'));
|
||||||
font-size: $toolbar-ios-title-font-size;
|
font-size: $toolbar-ios-title-font-size;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -52,13 +67,4 @@ $toolbar-ios-button-background-color: transparent !default;
|
|||||||
background: $toolbar-ios-button-background-color;
|
background: $toolbar-ios-button-background-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
// toolbar on top, border on bottom (default)
|
|
||||||
@include hairline(bottom, $toolbar-ios-border-color);
|
|
||||||
|
|
||||||
// toolbar on bottom, border on top
|
|
||||||
&.toolbar-bottom:after {
|
|
||||||
top: 0;
|
|
||||||
bottom: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
18
ionic/components/toolbar/toolbar-container.js
Normal file
18
ionic/components/toolbar/toolbar-container.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import {ElementRef} from 'angular2/angular2'
|
||||||
|
import {Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
|
|
||||||
|
import {IonicComponent} from 'ionic/config/component'
|
||||||
|
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '.toolbar-container'
|
||||||
|
})
|
||||||
|
export class ToolbarContainer {
|
||||||
|
constructor(elementRef: ElementRef) {
|
||||||
|
this.domElement = elementRef.domElement;
|
||||||
|
this.config = ToolbarContainer.config.invoke(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
new IonicComponent(ToolbarContainer, {})
|
@ -17,10 +17,8 @@ import {Platform} from 'ionic/platform/platform';
|
|||||||
<div class="toolbar-inner">
|
<div class="toolbar-inner">
|
||||||
<button class="button back-button toolbar-item" style="display:none"></button>
|
<button class="button back-button toolbar-item" style="display:none"></button>
|
||||||
<div class="toolbar-title">
|
<div class="toolbar-title">
|
||||||
<div class="toolbar-inner-title">
|
|
||||||
<content select="ion-title"></content>
|
<content select="ion-title"></content>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="toolbar-item toolbar-primary-item">
|
<div class="toolbar-item toolbar-primary-item">
|
||||||
<content select=".primary"></content>
|
<content select=".primary"></content>
|
||||||
</div>
|
</div>
|
||||||
@ -31,7 +29,13 @@ import {Platform} from 'ionic/platform/platform';
|
|||||||
`,
|
`,
|
||||||
directives: [ToolbarTitle]
|
directives: [ToolbarTitle]
|
||||||
})
|
})
|
||||||
export class Toolbar {}
|
export class Toolbar {
|
||||||
|
constructor(elementRef: ElementRef) {
|
||||||
|
this.domElement = elementRef.domElement;
|
||||||
|
this.config = Toolbar.config.invoke(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new IonicComponent(Toolbar, {});
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -39,7 +43,7 @@ export class Toolbar {}
|
|||||||
})
|
})
|
||||||
@View({
|
@View({
|
||||||
template: `
|
template: `
|
||||||
<div class="toolbar-inner-title toolbar-title-hide">
|
<div class="toolbar-inner-title">
|
||||||
<content></content>
|
<content></content>
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
|
@ -15,12 +15,15 @@ $toolbar-title-flex-order: 5;
|
|||||||
$toolbar-secondary-flex-order: 10;
|
$toolbar-secondary-flex-order: 10;
|
||||||
|
|
||||||
|
|
||||||
|
.toolbar-container {
|
||||||
|
background: $toolbar-background;
|
||||||
|
}
|
||||||
|
|
||||||
ion-toolbar {
|
ion-toolbar {
|
||||||
/*@include flex-display();
|
/*@include flex-display();
|
||||||
@include flex-direction(row);
|
@include flex-direction(row);
|
||||||
@include flex-align-items(center);
|
@include flex-align-items(center);
|
||||||
@include flex-justify-content(space-between);*/
|
@include flex-justify-content(space-between);*/
|
||||||
background: $toolbar-background;
|
|
||||||
|
|
||||||
// by default ion-toolbar is hidden
|
// by default ion-toolbar is hidden
|
||||||
// and the transition animation will display it
|
// and the transition animation will display it
|
||||||
|
Reference in New Issue
Block a user