mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
toolbar stuff and things
This commit is contained in:
@ -7,3 +7,4 @@ $z-index-action-menu: 110;
|
||||
$z-index-alert: 100;
|
||||
$z-index-content: 1;
|
||||
$z-index-list-border: 50;
|
||||
$z-index-toolbar-border: 20;
|
||||
|
@ -41,7 +41,8 @@
|
||||
// Android Components
|
||||
@import
|
||||
"../list/extensions/android",
|
||||
"../item/extensions/android";
|
||||
"../item/extensions/android",
|
||||
"../toolbar/extensions/android";
|
||||
|
||||
|
||||
// iOS Components
|
||||
@ -50,7 +51,8 @@
|
||||
"../list/extensions/ios",
|
||||
"../item/extensions/ios",
|
||||
"../radio/extensions/ios",
|
||||
"../switch/extensions/ios";
|
||||
"../switch/extensions/ios",
|
||||
"../toolbar/extensions/ios";
|
||||
|
||||
|
||||
// Icons
|
||||
|
18
src/components/toolbar/extensions/android.scss
Normal file
18
src/components/toolbar/extensions/android.scss
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
// Android Toolbar
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
.toolbar-android {
|
||||
|
||||
.spacer {
|
||||
@include flex(none);
|
||||
}
|
||||
|
||||
.title {
|
||||
position: static;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
}
|
53
src/components/toolbar/extensions/ios.scss
Normal file
53
src/components/toolbar/extensions/ios.scss
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
// iOS Toolbar
|
||||
// --------------------------------------------------
|
||||
|
||||
$toolbar-ios-height: 44px !default;
|
||||
$toolbar-ios-background: #f7f7f8 !default;
|
||||
$toolbar-ios-border-color: #c4c4c4 !default;
|
||||
|
||||
$toolbar-ios-title-font-size: 17px !default;
|
||||
$toolbar-ios-button-font-size: 17px !default;
|
||||
$toolbar-ios-button-color: #007aff !default;
|
||||
|
||||
|
||||
.toolbar-ios {
|
||||
height: $toolbar-ios-height;
|
||||
background: $toolbar-ios-background;
|
||||
|
||||
&:after {
|
||||
position: absolute;
|
||||
top: auto;
|
||||
right: auto;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: $z-index-toolbar-border;
|
||||
display: block;
|
||||
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
|
||||
background-color: $toolbar-ios-border-color;
|
||||
|
||||
@include transform-origin(50%, 100%);
|
||||
|
||||
content: '';
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: $toolbar-ios-title-font-size;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
font-size: $toolbar-ios-button-font-size;
|
||||
color: $toolbar-ios-button-color;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0 10px;
|
||||
min-height: $toolbar-ios-height;
|
||||
min-width: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
}
|
1
src/components/toolbar/test/basic/e2e.js
Normal file
1
src/components/toolbar/test/basic/e2e.js
Normal file
@ -0,0 +1 @@
|
||||
|
@ -6,15 +6,15 @@
|
||||
</ion-view-title>
|
||||
|
||||
<ion-nav-items side="primary">
|
||||
<button>p1</button>
|
||||
<button>p2</button>
|
||||
<button>p3</button>
|
||||
<button>p4</button>
|
||||
<button class="button">p1</button>
|
||||
<button class="button">p2</button>
|
||||
<button class="button">p3</button>
|
||||
<button class="button">p4</button>
|
||||
</ion-nav-items>
|
||||
|
||||
<ion-nav-items side="secondary">
|
||||
<button>s1</button>
|
||||
<button>s2</button>
|
||||
<button class="button">s1</button>
|
||||
<button class="button">s2</button>
|
||||
</ion-nav-items>
|
||||
|
||||
<ion-content>
|
@ -8,9 +8,8 @@ import {NgElement, Component, Template} from 'angular2/angular2'
|
||||
})
|
||||
@Template({
|
||||
inline: `
|
||||
<div class="bar bar-ios">
|
||||
<div class="bar-items">
|
||||
<button class="back-button bar-item">
|
||||
<button class="button back-button bar-item">
|
||||
<div class="back-button-icon"><</div>
|
||||
<div class="back-button-text">
|
||||
<div class="back-default">Back</div>
|
||||
@ -23,24 +22,24 @@ import {NgElement, Component, Template} from 'angular2/angular2'
|
||||
<content select="ion-view-title"></content>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bar-item bar-primary-item" style="background:red">
|
||||
<div class="bar-item bar-primary-item">
|
||||
<content select="ion-nav-items[side=primary]"></content>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<div class="bar-item bar-secondary-item" style="background:green">
|
||||
<div class="bar-item bar-secondary-item">
|
||||
<content select="ion-nav-items[side=secondary]"></content>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
export class Toolbar {
|
||||
constructor(@NgElement() ngEle:NgElement) {
|
||||
this.ele = ngEle.domElement
|
||||
this.ele.classList.add('toolbar')
|
||||
this.ele.classList.add('toolbar-ios')
|
||||
|
||||
window.requestAnimationFrame(() => {
|
||||
this.alignTitle()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
alignTitle(ele) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Toolbar
|
||||
// --------------------------------------------------
|
||||
|
||||
.bar {
|
||||
.toolbar {
|
||||
position: relative;
|
||||
@include flex-display();
|
||||
@include flex-direction(row);
|
||||
@ -19,8 +19,8 @@
|
||||
}
|
||||
|
||||
.bar-items {
|
||||
@include flex(1);
|
||||
@include flex-display();
|
||||
@include flex(1);
|
||||
@include flex-justify-content(space-between);
|
||||
}
|
||||
|
||||
@ -36,10 +36,9 @@
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: maroon;
|
||||
|
||||
@include flex(1);
|
||||
@include flex-display();
|
||||
@include flex(1);
|
||||
@include flex-align-items(center);
|
||||
}
|
||||
|
||||
@ -49,33 +48,15 @@
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
.back-button {
|
||||
@include flex-display();
|
||||
background: purple;
|
||||
|
||||
.back-button-icon {
|
||||
background: orange;
|
||||
}
|
||||
}
|
||||
|
||||
.bar-items > .spacer {
|
||||
@include flex(1);
|
||||
}
|
||||
|
||||
.bar-android {
|
||||
|
||||
.spacer {
|
||||
@include flex(none);
|
||||
}
|
||||
|
||||
.title {
|
||||
position: static;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user