Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppBar: Use appBarText for text/icon colors #12937

2 changes: 2 additions & 0 deletions kolibri/core/assets/src/styles/themeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Vue from 'vue';

const themeConfig = Vue.observable({
appBar: {
background: null,
textColor: null,
topLogo: {
src: null,
alt: null,
Expand Down
20 changes: 20 additions & 0 deletions kolibri/core/assets/src/styles/themeSpec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logger from 'kolibri.lib.logging';
import { themeTokens } from 'kolibri-design-system/lib/styles/theme';
import isObject from 'lodash/isObject';

const logging = logger.getLogger(__filename);
Expand Down Expand Up @@ -42,6 +43,25 @@ const _imageSpec = {
};

export default {
appBar: {
type: Object,
default: null,
spec: {
background: {
type: String,
default: themeTokens().appBar,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to update it here - but if we are going to remove it from the themeTokens in KDS, might just want this to map to something more directly.

},
textColor: {
type: String,
default: themeTokens().text,
},
topLogo: {
type: Object,
default: null,
spec: _imageSpec,
},
},
},
brandColors: {
type: Object,
default: null,
Expand Down
16 changes: 11 additions & 5 deletions kolibri/core/assets/src/views/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

<div
v-show="!$isPrint"
:style="{ backgroundColor: $themeTokens.appBar }"
:style="{
backgroundColor: themeConfig.appBar.background,
color: themeConfig.appBar.textColor,
}"
>
<header>
<SkipNavigationLink />

<UiToolbar
:removeNavIcon="showAppNavView"
type="clear"
textColor="black"
:textColor="themeConfig.appBar.textColor"
class="app-bar"
:style="{ height: topBarHeight + 'px' }"
:style="{
height: topBarHeight + 'px',
color: themeConfig.appBar.textColor,
}"
:raised="false"
:removeBrandDivider="true"
>
Expand All @@ -26,7 +32,7 @@
>
<KIconButton
icon="menu"
:color="$themeTokens.text"
:color="themeConfig.appBar.textColor"
:ariaLabel="$tr('openNav')"
@click="$emit('toggleSideNav')"
/>
Expand Down Expand Up @@ -94,7 +100,7 @@
<KIcon
icon="person"
:style="{
fill: $themeTokens.text,
fill: themeConfig.appBar.textColor,
height: '24px',
width: '24px',
margin: '4px',
Expand Down
6 changes: 4 additions & 2 deletions kolibri/core/assets/src/views/Navbar/NavbarLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import { validateLinkObject } from 'kolibri.utils.validators';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import themeConfig from 'kolibri.themeConfig';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self - this import path will need to be updated when we merge up.


/**
Links for use inside the Navbar
Expand All @@ -38,6 +39,7 @@
setup() {
const { windowIsSmall } = useKResponsiveWindow();
return {
themeConfig,
windowIsSmall,
};
},
Expand All @@ -61,7 +63,7 @@
computed: {
tabStyles() {
return {
color: this.$themeTokens.text,
color: this.themeConfig.appBar.textColor,
':hover': {
'background-color': this.$themeBrand.secondary.v_600,
},
Expand All @@ -81,7 +83,7 @@
activeClasses() {
// return both fixed and dynamic classes
return `router-link-active ${this.$computedClass({
color: this.$themeTokens.text,
color: this.themeConfig.appBar.textColor,
})}`;
},
},
Expand Down
6 changes: 4 additions & 2 deletions kolibri/core/assets/src/views/Navbar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
>
<KIcon
:icon="link.icon"
:color="$themeTokens.text"
:color="themeConfig.appBar.textColor"
/>
</NavbarLink>
</ul>
Expand All @@ -27,7 +27,7 @@
:ariaLabel="coreString('moreOptions')"
icon="optionsHorizontal"
appearance="flat-button"
:color="$themeTokens.text"
:color="themeConfig.appBar.textColor"
:primary="false"
class="kiconbutton-style"
>
Expand All @@ -51,6 +51,7 @@
import isUndefined from 'lodash/isUndefined';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import themeConfig from 'kolibri.themeConfig';
import NavbarLink from './NavbarLink';
/**
* Used for navigation between sub-pages of a top-level Kolibri section
Expand All @@ -67,6 +68,7 @@
windowIsLarge,
windowIsMedium,
windowWidth,
themeConfig,
};
},
props: {
Expand Down
3 changes: 2 additions & 1 deletion kolibri/core/assets/src/views/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@
height: topBarHeight + 'px',
width: `${width}`,
paddingTop: windowIsSmall ? '4px' : '8px',
backgroundColor: $themeTokens.appBar,
backgroundColor: themeConfig.appBar.background,
color: themeConfig.appBar.textColor,
}"
>
<KIconButton
Expand Down
Loading