mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
tab-bar/toolbar alignment
This commit is contained in:
15
src/components/app/flex-order.scss
Normal file
15
src/components/app/flex-order.scss
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
// Flex Order
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
// the rock that everything orders around
|
||||||
|
$flex-order-view-content: 40 !default;
|
||||||
|
|
||||||
|
|
||||||
|
$flex-order-toolbar-top: 20 !default;
|
||||||
|
$flex-order-toolbar-bottom: 60 !default;
|
||||||
|
|
||||||
|
|
||||||
|
$flex-order-tab-bar-top: 30 !default;
|
||||||
|
$flex-order-tab-bar-bottom: 50 !default;
|
@ -70,39 +70,50 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
@mixin hairline($placement, $line-color, $z-index: 999) {
|
@mixin hairline($placement, $line-color, $z-index: 999) {
|
||||||
|
// use $line-color: none to override existing hairline settings
|
||||||
|
|
||||||
@if $placement == top {
|
@if $placement == top {
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
position: absolute;
|
@if $line-color == none {
|
||||||
top: 0;
|
background-color: inherit;
|
||||||
right: auto;
|
|
||||||
bottom: auto;
|
} @else {
|
||||||
left: 0;
|
position: absolute;
|
||||||
z-index: $z-index;
|
top: 0;
|
||||||
display: block;
|
right: auto;
|
||||||
width: 100%;
|
bottom: auto;
|
||||||
height: 1px;
|
left: 0;
|
||||||
@include transform-origin(50%, 0%);
|
z-index: $z-index;
|
||||||
background-color: $line-color;
|
display: block;
|
||||||
content: '';
|
width: 100%;
|
||||||
|
height: 1px;
|
||||||
|
@include transform-origin(50%, 0%);
|
||||||
|
background-color: $line-color;
|
||||||
|
content: '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} @else if $placement == bottom {
|
} @else if $placement == bottom {
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
position: absolute;
|
@if $line-color == none {
|
||||||
top: auto;
|
background-color: inherit;
|
||||||
right: auto;
|
|
||||||
bottom: 0;
|
} @else {
|
||||||
left: 0;
|
position: absolute;
|
||||||
z-index: $z-index;
|
top: auto;
|
||||||
display: block;
|
right: auto;
|
||||||
width: 100%;
|
bottom: 0;
|
||||||
height: 1px;
|
left: 0;
|
||||||
@include transform-origin(50%, 0%);
|
z-index: $z-index;
|
||||||
background-color: $line-color;
|
display: block;
|
||||||
content: '';
|
width: 100%;
|
||||||
|
height: 1px;
|
||||||
|
@include transform-origin(50%, 0%);
|
||||||
|
background-color: $line-color;
|
||||||
|
content: '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ html {
|
|||||||
// container of many .nav-pane's, each one containing one view
|
// container of many .nav-pane's, each one containing one view
|
||||||
position: relative;
|
position: relative;
|
||||||
@include flex(1);
|
@include flex(1);
|
||||||
|
@include flex-order($flex-order-view-content);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-pane-container {
|
.tab-pane-container {
|
||||||
@ -54,6 +55,7 @@ html {
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@include flex-order($flex-order-view-content);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-pane {
|
.nav-pane {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Android Toolbar
|
// Android Toolbar
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
$tab-bar-android-min-height: 40px !default;
|
||||||
$tab-bar-android-item-padding: 4px 10px !default;
|
$tab-bar-android-item-padding: 4px 10px !default;
|
||||||
$tab-bar-android-active-border-width: 3px !default;
|
$tab-bar-android-active-border-width: 3px !default;
|
||||||
$tab-bar-android-active-border-color: red !default;
|
$tab-bar-android-active-border-color: red !default;
|
||||||
@ -11,6 +12,10 @@ $tab-bar-android-text-font-weight: 500 !default;
|
|||||||
|
|
||||||
.tabs-android {
|
.tabs-android {
|
||||||
|
|
||||||
|
.tab-bar-container {
|
||||||
|
min-height: $tab-bar-android-min-height;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-bar-item {
|
.tab-bar-item {
|
||||||
padding: $tab-bar-item-padding;
|
padding: $tab-bar-item-padding;
|
||||||
text-transform: $tab-bar-android-text-transform;
|
text-transform: $tab-bar-android-text-transform;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// iOS Toolbar
|
// iOS Toolbar
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
$tab-bar-ios-min-height: 52px !default;
|
||||||
|
|
||||||
$tab-bar-ios-item-padding: 3px 10px !default;
|
$tab-bar-ios-item-padding: 3px 10px !default;
|
||||||
$tab-bar-ios-item-font-size: 1.1rem !default;
|
$tab-bar-ios-item-font-size: 1.1rem !default;
|
||||||
$tab-bar-ios-item-icon-size: 2.8rem !default;
|
$tab-bar-ios-item-icon-size: 2.8rem !default;
|
||||||
@ -9,6 +11,10 @@ $tab-bar-ios-item-icon-size: 2.8rem !default;
|
|||||||
|
|
||||||
.tabs-ios {
|
.tabs-ios {
|
||||||
|
|
||||||
|
.tab-bar-container {
|
||||||
|
min-height: $tab-bar-ios-min-height;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-bar-item {
|
.tab-bar-item {
|
||||||
padding: $tab-bar-ios-item-padding;
|
padding: $tab-bar-ios-item-padding;
|
||||||
}
|
}
|
||||||
@ -21,12 +27,16 @@ $tab-bar-ios-item-icon-size: 2.8rem !default;
|
|||||||
font-size: $tab-bar-ios-item-icon-size;
|
font-size: $tab-bar-ios-item-icon-size;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .tab-bar.toolbar-bottom {
|
&.tab-bar-bottom > .tab-bar-container {
|
||||||
@include hairline(top, $toolbar-ios-border-color);
|
@include hairline(top, $toolbar-ios-border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
> .tab-bar.toolbar-top {
|
&.tab-bar-top > .tab-bar-container {
|
||||||
@include hairline(bottom, $toolbar-ios-border-color);
|
@include hairline(bottom, $toolbar-ios-border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.tab-bar-top > .toolbar-container .toolbar {
|
||||||
|
@include hairline(bottom, none);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,12 @@ import {IonicComponent} from 'ionic2/config/component'
|
|||||||
@Template({
|
@Template({
|
||||||
inline: `
|
inline: `
|
||||||
<header class="toolbar-container">
|
<header class="toolbar-container">
|
||||||
<!-- COLLECTION OF TOOLBARS FOR EACH OF ITS VIEWS WITHIN THIS NAV-VIEWPORT -->
|
<!-- COLLECTION OF TOOLBARS FOR EACH VIEW WITHIN EACH TAB-VIEWPORT -->
|
||||||
<!-- TOOLBARS FOR EACH VIEW SHOULD HAVE THE SAME CONTEXT AS ITS VIEW -->
|
<!-- TOOLBARS FOR EACH VIEW SHOULD HAVE THE SAME CONTEXT AS ITS VIEW -->
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<nav class="tab-bar">
|
<nav class="tab-bar-container">
|
||||||
<div class="tab-bar-container">
|
<div class="tab-bar">
|
||||||
<a *for="#tab of tabs"
|
<a *for="#tab of tabs"
|
||||||
class="tab-bar-item"
|
class="tab-bar-item"
|
||||||
[class.tab-active]="tab.isSelected"
|
[class.tab-active]="tab.isSelected"
|
||||||
@ -47,6 +47,14 @@ export class Tabs {
|
|||||||
this.domElement.classList.add('nav-pane-cover-parent')
|
this.domElement.classList.add('nav-pane-cover-parent')
|
||||||
|
|
||||||
// .tab-bar-top/bottom should be added to the entire element when specified
|
// .tab-bar-top/bottom should be added to the entire element when specified
|
||||||
|
// TODO: MAKE MORE GOOD!!!
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.placement == 'top') {
|
||||||
|
this.domElement.classList.add('tab-bar-top')
|
||||||
|
} else {
|
||||||
|
this.domElement.classList.add('tab-bar-bottom')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
this.config = Tabs.config.invoke(this)
|
this.config = Tabs.config.invoke(this)
|
||||||
this.tabs = []
|
this.tabs = []
|
||||||
|
@ -16,13 +16,22 @@ $tab-bar-item-max-width: 160px !default;
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-bar {
|
.tab-bar-top > .tab-bar-container {
|
||||||
|
@include flex-order($flex-order-tab-bar-top);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-bar-bottom > .tab-bar-container {
|
||||||
|
@include flex-order($flex-order-tab-bar-bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-bar-container {
|
||||||
@include flex-justify-content(center);
|
@include flex-justify-content(center);
|
||||||
|
position: relative;
|
||||||
min-height: $tab-bar-min-height;
|
min-height: $tab-bar-min-height;
|
||||||
background: $tab-bar-background-color;
|
background: $tab-bar-background-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-bar-container {
|
.tab-bar {
|
||||||
@include flex-display();
|
@include flex-display();
|
||||||
@include flex-justify-content(center);
|
@include flex-justify-content(center);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -14,11 +14,11 @@ $toolbar-background: #f7f7f8 !default;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-top {
|
.toolbar-top {
|
||||||
@include flex-order(20);
|
@include flex-order($flex-order-toolbar-top);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-bottom {
|
.toolbar-bottom {
|
||||||
@include flex-order(80);
|
@include flex-order($flex-order-toolbar-bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-items {
|
.toolbar-items {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// Globals
|
// Globals
|
||||||
@import
|
@import
|
||||||
"components/app/z-index",
|
"components/app/z-index",
|
||||||
|
"components/app/flex-order",
|
||||||
"components/app/normalize",
|
"components/app/normalize",
|
||||||
"components/app/globals",
|
"components/app/globals",
|
||||||
"components/app/colors",
|
"components/app/colors",
|
||||||
@ -69,12 +70,12 @@
|
|||||||
"components/toolbar/extensions/android";
|
"components/toolbar/extensions/android";
|
||||||
|
|
||||||
|
|
||||||
|
// Icons
|
||||||
|
@import
|
||||||
|
"components/icon/icon";
|
||||||
|
|
||||||
|
|
||||||
// Web View Adaptors
|
// Web View Adaptors
|
||||||
@import
|
@import
|
||||||
"webview/cordova/cordova",
|
"webview/cordova/cordova",
|
||||||
"webview/node-webkit/node-webkit";
|
"webview/node-webkit/node-webkit";
|
||||||
|
|
||||||
|
|
||||||
// Icons
|
|
||||||
@import
|
|
||||||
"components/icon/icon";
|
|
||||||
|
Reference in New Issue
Block a user