Skip to content

Commit

Permalink
fix(tabs): fix the tabs so the color property works on tab button
Browse files Browse the repository at this point in the history
fixes #14758
  • Loading branch information
brandyscarney committed Jul 13, 2018
1 parent ad63e48 commit 8aed3bf
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 27 deletions.
8 changes: 4 additions & 4 deletions core/src/components/tab-button/tab-button.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
@import "./tab-button.ios.vars";

:host {
--color: #{$tab-button-ios-text-color};
--color-selected: #{$tabbar-ios-text-color-active};
--background-focused: #{$tabbar-ios-background-color-focused};

max-width: $tab-button-ios-max-width;

font-size: $tab-button-ios-font-size;
color: $tab-button-ios-text-color;

--color-selected: #{$tabbar-ios-text-color-active};
--background-focused: #{$tabbar-ios-background-color-focused};
}

.tab-button-native {
Expand Down
9 changes: 4 additions & 5 deletions core/src/components/tab-button/tab-button.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
// --------------------------------------------------

:host {
--color: #{$tab-button-md-text-color};
--color-selected: #{$tabbar-md-text-color-active};
--background-focused: #{$tabbar-md-background-color-focused};

max-width: 168px;

font-weight: $tab-button-md-font-weight;

color: $tab-button-md-text-color;

--color-selected: #{$tabbar-md-text-color-active};
--background-focused: #{$tabbar-md-background-color-focused};
}

.tab-button-native {
Expand Down
11 changes: 3 additions & 8 deletions core/src/components/tab-button/tab-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@
border: 0;

text-decoration: none;
background: none;

background: var(--background);
color: var( --color);

user-select: none;

box-sizing: border-box;
}

:host(.ion-color) {
color: #{current-color(contrast)};

--color-selected: #{current-color(contrast)};
--background-selected: #{current-color(shade)};
}

:host(.focused) {
background: var(--background-focused);
}
Expand Down
9 changes: 5 additions & 4 deletions core/src/components/tabbar/tabbar.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
// --------------------------------------------------

:host {
// default color / background
--background: #{$tabbar-ios-background-color};
--background-rgb: var(--ion-tabbar-translucent-background-color-rgb, 248, 248, 248);
--color: #{$tabbar-ios-text-color-active};

justify-content: center;

height: $tabbar-ios-height;

border-top: $tabbar-ios-border;

--ion-color-base: #{$tabbar-ios-background-color};
--ion-color-base-rgb: var(--ion-tabbar-translucent-background-color-rgb, 248, 248, 248);
--ion-color-contrast: #{$tabbar-ios-text-color-active};

contain: strict;
}

Expand Down
8 changes: 4 additions & 4 deletions core/src/components/tabbar/tabbar.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
@import "./tabbar.md.vars";

:host {
// default color / background
--background: #{$tabbar-md-background-color};
--color: #{$tabbar-md-text-color-active};

height: $tabbar-md-height;

border-top: $tabbar-md-border;

--ion-color-base: #{$tabbar-md-background-color};
--ion-color-contrast: #{$tabbar-md-text-color-active};

contain: strict;
}

Expand All @@ -18,7 +19,6 @@ ion-scroll {
max-width: 650px;
}


// TODO: REVIEW
:host(.placement-top) .tab-button.tab-selected .tab-button-icon,
:host(.placement-top) .tab-button.tab-selected .tab-button-text {
Expand Down
10 changes: 8 additions & 2 deletions core/src/components/tabbar/tabbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@

width: 100%;

background: #{current-color(base)};
color: #{current-color(contrast)};
background: var(--background);
color: var(--color);
}

:host(.ion-color) ion-tab-button {
--background: #{current-color(base)};
--color: #{current-color(contrast, .7)};
--color-selected: #{current-color(contrast)};
}

:host(.tabbar-hidden) {
Expand Down
7 changes: 7 additions & 0 deletions core/src/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Build, Component, Element, Event, EventEmitter, Listen, Method, Prop, State } from '@stencil/core';
import { Color, Config, NavOutlet, RouteID, RouteWrite, TabbarLayout, TabbarPlacement } from '../../interface';
import { createColorClasses } from '../../utils/theme';


@Component({
Expand Down Expand Up @@ -298,6 +299,12 @@ export class Tabs implements NavOutlet {
return !!(selectedTab && selectedTab !== leavingTab && !this.transitioning);
}

hostData() {
return {
class: createColorClasses(this.color)
};
}

render() {
const dom = [
<div class="tabs-inner">
Expand Down

0 comments on commit 8aed3bf

Please sign in to comment.