From a55d0ab478812e5cfed45cabff929de7a0616fcd Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 10 Apr 2015 15:36:43 -0500 Subject: [PATCH] tab-bar/toolbar alignment --- src/components/app/flex-order.scss | 15 ++++++ src/components/app/mixins/util.scss | 59 ++++++++++++--------- src/components/app/scaffolding.scss | 2 + src/components/tabs/extensions/android.scss | 5 ++ src/components/tabs/extensions/ios.scss | 14 ++++- src/components/tabs/tabs.js | 14 +++-- src/components/tabs/tabs.scss | 13 ++++- src/components/toolbar/toolbar.scss | 4 +- src/ionic.scss | 11 ++-- 9 files changed, 99 insertions(+), 38 deletions(-) create mode 100644 src/components/app/flex-order.scss diff --git a/src/components/app/flex-order.scss b/src/components/app/flex-order.scss new file mode 100644 index 0000000000..468e86a681 --- /dev/null +++ b/src/components/app/flex-order.scss @@ -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; diff --git a/src/components/app/mixins/util.scss b/src/components/app/mixins/util.scss index e23e85f9e6..e4cc83b504 100644 --- a/src/components/app/mixins/util.scss +++ b/src/components/app/mixins/util.scss @@ -70,39 +70,50 @@ // -------------------------------------------------- @mixin hairline($placement, $line-color, $z-index: 999) { + // use $line-color: none to override existing hairline settings @if $placement == top { &:before { - position: absolute; - top: 0; - right: auto; - bottom: auto; - left: 0; - z-index: $z-index; - display: block; - width: 100%; - height: 1px; - @include transform-origin(50%, 0%); - background-color: $line-color; - content: ''; + @if $line-color == none { + background-color: inherit; + + } @else { + position: absolute; + top: 0; + right: auto; + bottom: auto; + left: 0; + z-index: $z-index; + display: block; + width: 100%; + height: 1px; + @include transform-origin(50%, 0%); + background-color: $line-color; + content: ''; + } } } @else if $placement == bottom { &:after { - position: absolute; - top: auto; - right: auto; - bottom: 0; - left: 0; - z-index: $z-index; - display: block; - width: 100%; - height: 1px; - @include transform-origin(50%, 0%); - background-color: $line-color; - content: ''; + @if $line-color == none { + background-color: inherit; + + } @else { + position: absolute; + top: auto; + right: auto; + bottom: 0; + left: 0; + z-index: $z-index; + display: block; + width: 100%; + height: 1px; + @include transform-origin(50%, 0%); + background-color: $line-color; + content: ''; + } } } diff --git a/src/components/app/scaffolding.scss b/src/components/app/scaffolding.scss index 360737a1e9..231b8b4a90 100644 --- a/src/components/app/scaffolding.scss +++ b/src/components/app/scaffolding.scss @@ -47,6 +47,7 @@ html { // container of many .nav-pane's, each one containing one view position: relative; @include flex(1); + @include flex-order($flex-order-view-content); } .tab-pane-container { @@ -54,6 +55,7 @@ html { position: relative; width: 100%; height: 100%; + @include flex-order($flex-order-view-content); } .nav-pane { diff --git a/src/components/tabs/extensions/android.scss b/src/components/tabs/extensions/android.scss index d1fe74304e..9e71d4be1b 100644 --- a/src/components/tabs/extensions/android.scss +++ b/src/components/tabs/extensions/android.scss @@ -2,6 +2,7 @@ // Android Toolbar // -------------------------------------------------- +$tab-bar-android-min-height: 40px !default; $tab-bar-android-item-padding: 4px 10px !default; $tab-bar-android-active-border-width: 3px !default; $tab-bar-android-active-border-color: red !default; @@ -11,6 +12,10 @@ $tab-bar-android-text-font-weight: 500 !default; .tabs-android { + .tab-bar-container { + min-height: $tab-bar-android-min-height; + } + .tab-bar-item { padding: $tab-bar-item-padding; text-transform: $tab-bar-android-text-transform; diff --git a/src/components/tabs/extensions/ios.scss b/src/components/tabs/extensions/ios.scss index 13d92c6a66..c3239a9a16 100644 --- a/src/components/tabs/extensions/ios.scss +++ b/src/components/tabs/extensions/ios.scss @@ -2,6 +2,8 @@ // iOS Toolbar // -------------------------------------------------- +$tab-bar-ios-min-height: 52px !default; + $tab-bar-ios-item-padding: 3px 10px !default; $tab-bar-ios-item-font-size: 1.1rem !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 { + .tab-bar-container { + min-height: $tab-bar-ios-min-height; + } + .tab-bar-item { 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; } - > .tab-bar.toolbar-bottom { + &.tab-bar-bottom > .tab-bar-container { @include hairline(top, $toolbar-ios-border-color); } - > .tab-bar.toolbar-top { + &.tab-bar-top > .tab-bar-container { @include hairline(bottom, $toolbar-ios-border-color); } + &.tab-bar-top > .toolbar-container .toolbar { + @include hairline(bottom, none); + } + } diff --git a/src/components/tabs/tabs.js b/src/components/tabs/tabs.js index 7bc017b5f3..70fbc2ba07 100644 --- a/src/components/tabs/tabs.js +++ b/src/components/tabs/tabs.js @@ -12,12 +12,12 @@ import {IonicComponent} from 'ionic2/config/component' @Template({ inline: `
- +
-