mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
toolbar thingz
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
html, body {
|
html,
|
||||||
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ ion-app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-container {
|
.toolbar-container {
|
||||||
// container of many toolbars for each view in the .nav
|
// container of many toolbars for each view in the ion-nav
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
@ -39,11 +40,12 @@ ion-app {
|
|||||||
@include flex-order($flex-order-toolbar-bottom);
|
@include flex-order($flex-order-toolbar-bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar {
|
ion-toolbar {
|
||||||
// one view's toolbar, sibling to many view toolbars insde of .toolbar-container
|
// one view's toolbar, sibling to many view toolbars inside of .toolbar-container
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
@ -63,29 +65,21 @@ ion-app {
|
|||||||
@include flex-order($flex-order-view-content);
|
@include flex-order($flex-order-view-content);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-item-cover-parent {
|
|
||||||
// .nav-item that should completely cover siblings and parent
|
|
||||||
top: -50px;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
// by default .nav-item is hidden
|
// user created view, sibling to many .nav-item's, contained by .nav-item-container
|
||||||
// and the transition animation will display it
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item,
|
|
||||||
.nav-item-child {
|
|
||||||
// user created view, contained by .nav-item
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
// by default .nav-item is hidden
|
||||||
|
// and the transition animation will display it
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
ion-content {
|
ion-content {
|
||||||
|
// content within the user created view, contained by .nav-item
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -94,6 +88,7 @@ ion-app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scroll-content {
|
.scroll-content {
|
||||||
|
// extra div to allow overflow scrolling
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
<div *ion-header>
|
<ion-toolbar *header>
|
||||||
|
|
||||||
<h1 class="toolbar-title">First Page: Instance {{ val }}</h1>
|
<ion-title>First Page: {{ val }}</ion-title>
|
||||||
|
|
||||||
</div>
|
</ion-toolbar>
|
||||||
|
|
||||||
|
|
||||||
<ion-content class="padding" style="background:lightblue">
|
<ion-content class="padding" style="background:lightblue">
|
||||||
|
|
||||||
<p>First Page: Instance {{ val }}</p>
|
<p>First Page: {{ val }}</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<button (click)="push()">Push (Go to 2nd)</button>
|
<button (click)="push()">Push (Go to 2nd)</button>
|
||||||
|
@ -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} 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]
|
directives: [Header, ToolbarTitle, Toolbar]
|
||||||
})
|
})
|
||||||
export class FirstPage {
|
export class FirstPage {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
<div *ion-header>
|
<ion-toolbar *header>
|
||||||
|
|
||||||
<h1 class="toolbar-title">Second Page</h1>
|
<ion-title>Second Page</ion-title>
|
||||||
|
|
||||||
</div>
|
</ion-toolbar>
|
||||||
|
|
||||||
|
|
||||||
<ion-content class="padding" style="background:green">
|
<ion-content class="padding" style="background:green">
|
||||||
|
@ -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, NavParams, Header} from 'ionic/ionic';
|
import {NavController, NavParams, Header, ToolbarTitle, Toolbar} from 'ionic/ionic';
|
||||||
import {ThirdPage} from './third-page';
|
import {ThirdPage} from './third-page';
|
||||||
|
|
||||||
|
|
||||||
@Component()
|
@Component()
|
||||||
@View({
|
@View({
|
||||||
templateUrl: 'pages/second-page.html',
|
templateUrl: 'pages/second-page.html',
|
||||||
directives: [Header]
|
directives: [Header, ToolbarTitle, Toolbar]
|
||||||
})
|
})
|
||||||
export class SecondPage {
|
export class SecondPage {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
<div *ion-header>
|
<ion-toolbar *header>
|
||||||
|
|
||||||
<h1 class="toolbar-title">Third Page</h1>
|
<ion-title>Third Page</ion-title>
|
||||||
|
|
||||||
</div>
|
</ion-toolbar>
|
||||||
|
|
||||||
|
|
||||||
<ion-content class="padding" style="background:yellow">
|
<ion-content class="padding" style="background:yellow">
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
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} from 'ionic/ionic';
|
import {NavController, Header, ToolbarTitle, Toolbar} from 'ionic/ionic';
|
||||||
|
|
||||||
|
|
||||||
@Component()
|
@Component()
|
||||||
@View({
|
@View({
|
||||||
templateUrl: 'pages/third-page.html',
|
templateUrl: 'pages/third-page.html',
|
||||||
directives: [Header]
|
directives: [Header, ToolbarTitle, Toolbar]
|
||||||
})
|
})
|
||||||
export class ThirdPage {
|
export class ThirdPage {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
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 {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||||
import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
|
import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
|
||||||
|
|
||||||
@ -8,20 +9,21 @@ import {NavItem} from 'ionic/ionic';
|
|||||||
import {Platform} from 'ionic/platform/platform';
|
import {Platform} from 'ionic/platform/platform';
|
||||||
|
|
||||||
|
|
||||||
@Directive({
|
@Component({
|
||||||
selector: '[ion-header]'
|
selector: 'ion-toolbar'
|
||||||
})
|
})
|
||||||
export class Header {
|
@View({
|
||||||
|
template: `<content></content>`
|
||||||
constructor(navItem: NavItem, protoViewRef: ProtoViewRef) {
|
})
|
||||||
navItem.addHeader(protoViewRef);
|
export class Toolbar {
|
||||||
|
constructor() {
|
||||||
|
console.log('ion-toolbar');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: '.toolbar-title'
|
selector: 'ion-title'
|
||||||
})
|
})
|
||||||
@View({
|
@View({
|
||||||
template: `
|
template: `
|
||||||
@ -30,9 +32,8 @@ export class Header {
|
|||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
export class ToolbarTitle {
|
export class ToolbarTitle {
|
||||||
constructor(
|
constructor(element: ElementRef) {
|
||||||
element: ElementRef
|
console.log('ion-title');
|
||||||
) {
|
|
||||||
// this.domElement = element.domElement;
|
// this.domElement = element.domElement;
|
||||||
|
|
||||||
// // TODO find better way to get parent toolbar
|
// // TODO find better way to get parent toolbar
|
||||||
@ -84,3 +85,18 @@ export class ToolbarTitle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Used to find and register headers in a view, and this directive's
|
||||||
|
content will be moved up to the common toolbar location, and created
|
||||||
|
using the same context as the view's content area.
|
||||||
|
*/
|
||||||
|
@Directive({
|
||||||
|
selector: 'template[header]'
|
||||||
|
})
|
||||||
|
export class Header {
|
||||||
|
constructor(navItem: NavItem, protoViewRef: ProtoViewRef) {
|
||||||
|
navItem.addHeader(protoViewRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user