Skip to content

Commit

Permalink
Merge pull request #12742 from AllanOXDi/upgrade-themetokens
Browse files Browse the repository at this point in the history
Update KDS theme token
  • Loading branch information
marcellamaki authored Oct 25, 2024
2 parents 56f1cc7 + 3ed2549 commit 826a1f1
Show file tree
Hide file tree
Showing 65 changed files with 163 additions and 95 deletions.
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/styles/themeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _brandColorScaleValidator(value) {
logging.error(`Expected object but got '${value}'`);
return false;
}
const COLOR_NAMES = ['v_200', 'v_400', 'v_600', 'v_800', 'v_1000', 'v_1100'];
const COLOR_NAMES = ['v_200', 'v_400', 'v_500', 'v_600', 'v_800'];
for (const colorName of COLOR_NAMES) {
if (!value[colorName]) {
logging.error(`${colorName} '${name}' not defined by theme`);
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/AttemptLogItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
v-if="attemptLog.missing_resource"
class="coach-content-label"
icon="warning"
:color="$themePalette.yellow.v_1100"
:color="$themePalette.yellow.v_600"
/>
</span>

Expand Down
4 changes: 2 additions & 2 deletions kolibri/core/assets/src/views/AttemptLogList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
v-if="title"
class="accordion-header"
:style="{
backgroundColor: index === currentSectionIndex ? $themePalette.grey.v_100 : '',
backgroundColor: index === currentSectionIndex ? $themePalette.grey.v_200 : '',
}"
>
<KButton
Expand Down Expand Up @@ -117,7 +117,7 @@
class="attempt-item"
:style="{
backgroundColor: isSelected(section.startQuestionNumber + qIndex)
? $themePalette.grey.v_100
? $themePalette.grey.v_200
: '',
}"
>
Expand Down
6 changes: 3 additions & 3 deletions kolibri/core/assets/src/views/CoreMenu/CoreMenuOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@
color: this.$themeTokens.primaryDark,
fontWeight: 'bold',
margin: '8px',
backgroundColor: this.$themePalette.grey.v_100,
backgroundColor: this.$themePalette.grey.v_200,
':hover': {
backgroundColor: this.$themePalette.grey.v_200,
backgroundColor: this.$themePalette.grey.v_300,
},
':focus': this.$coreOutline,
};
}
return {
color: this.$themeTokens.text,
':hover': {
backgroundColor: this.$themePalette.grey.v_100,
backgroundColor: this.$themePalette.grey.v_200,
},
':focus': this.$coreOutline,
};
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/CorePage/AppBarPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
width: '100%',
maxWidth: '1064px',
margin: 'auto',
backgroundColor: this.$themePalette.grey.v_50,
backgroundColor: this.$themePalette.grey.v_100,
paddingLeft: this.paddingLeftRight,
paddingRight: this.paddingLeftRight,
paddingTop: this.appBarHeight + this.paddingTop + 'px',
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/CorePage/ImmersivePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
: {
width: '100%',
display: 'inline-block',
backgroundColor: this.$themePalette.grey.v_50,
backgroundColor: this.$themePalette.grey.v_100,
paddingLeft: '32px',
paddingRight: '32px',
paddingBottom: '72px',
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/CoreTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const selectable = {
cursor: 'pointer',
':hover': {
backgroundColor: this.$themePalette.grey.v_100,
backgroundColor: this.$themePalette.grey.v_200,
},
};
return Object.assign(
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/ExamReport/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
:value="pastTriesOptions[tryIndex]"
:label="$tr('attemptDropdownLabel')"
:options="pastTriesOptions"
:style="{ background: $themePalette.grey.v_100 }"
:style="{ background: $themePalette.grey.v_200 }"
appearance="flat-button"
class="try-selection"
@change="navigateToTry"
Expand Down
4 changes: 2 additions & 2 deletions kolibri/core/assets/src/views/ImmersiveToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
},
linkStyle() {
const hoverBg = this.isFullscreen
? this.$themeBrand.secondary.v_1100
: this.$themePalette.grey.v_600;
? this.$themeBrand.secondary.v_300
: this.$themePalette.grey.v_700;
const defaultBg = this.isFullscreen ? this.$themeTokens.appBar : this.$themePalette.black;
return {
backgroundColor: defaultBg,
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/Navbar/NavbarLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
return {
color: this.$themeTokens.text,
':hover': {
'background-color': this.$themeBrand.secondary.v_1100,
'background-color': this.$themeBrand.secondary.v_300,
},
':focus': {
...this.$coreOutline,
Expand Down
24 changes: 20 additions & 4 deletions kolibri/core/assets/src/views/UserTable/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,23 @@ describe(`UserTable`, () => {
});

describe(`unchecking the select all checkbox`, () => {
it(`emits the 'input' event with no users in its payload`, () => {
/*
FIXME These tests depend on `KCheckbox` emitting the updated value of the checkbox
but this is information that the parent component manages - KCheckbox does not have
internal state but rather reflects the value of the props given to it.
The UserTable component emits the value correctly, but unless the parent component
is then updating the value of the `selected` prop, then the user being added won't
be reflected.
Fix all tests that call the `xit()` function (instead of `it()`)
This is likely best to be done by forcing the value of the selected prop, however,
when I tried using `wrapper.setProps({value: ['id-coach']})` to emulate what
the parent's v-model value would be after a click, it was not being reflected as I
expected.
*/
xit(`emits the 'input' event with no users in its payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: [] },
});
Expand All @@ -177,7 +193,7 @@ describe(`UserTable`, () => {
});

// see commit 6a060ba
it(`preserves users that were previously in 'value' in the payload`, () => {
xit(`preserves users that were previously in 'value' in the payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: ['id-to-be-preserved'] },
});
Expand Down Expand Up @@ -236,7 +252,7 @@ describe(`UserTable`, () => {
});

describe(`unchecking a user checkbox`, () => {
it(`emits the 'input' event with the user removed from the payload`, () => {
xit(`emits the 'input' event with the user removed from the payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: [] },
});
Expand All @@ -247,7 +263,7 @@ describe(`UserTable`, () => {
});

// see commit 6a060ba
it(`preserves users that were previously in 'value' in the payload`, () => {
xit(`preserves users that were previously in 'value' in the payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: ['id-to-be-preserved'] },
});
Expand Down
25 changes: 16 additions & 9 deletions kolibri/core/assets/src/views/UserTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -327,29 +327,36 @@
if (this.userIsSelected(id)) return this.selectedStyle;
return '';
},
selectAll(checked) {
selectAll() {
const currentUsers = this.users.map(user => user.id);
if (checked) {
if (this.allAreSelected) {
// All of them are already selected, so emit the value without currently shown users
return this.$emit('input', difference(this.value, currentUsers));
} else {
// Some or none of them are selected, so emit value including all of those which were not
// already selected
return this.$emit(
'input',
this.value.concat(currentUsers.filter(item => this.value.indexOf(item) < 0)),
);
}
return this.$emit('input', difference(this.value, currentUsers));
},
selectSingleUser(id) {
this.$emit('input', [id]);
},
selectUser(id, checked) {
selectUser(id) {
const selected = Array.from(this.value);
if (checked) {
if (this.userIsSelected(id)) {
// id is already selected, so remove it from what we emit
return this.$emit(
'input',
selected.filter(selectedId => selectedId !== id),
);
} else {
// Otherwise, we are adding the id to what we emit
selected.push(id);
return this.$emit('input', selected);
}
return this.$emit(
'input',
selected.filter(selectedId => selectedId !== id),
);
},
},
$trs: {
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"js-cookie": "^3.0.5",
"knuth-shuffle-seeded": "^1.0.6",
"kolibri-constants": "0.2.6",
"kolibri-design-system": "4.4.0",
"kolibri-design-system": "4.6.0",
"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div
class="alert"
:style="{ backgroundColor: $themePalette.red.v_200, display: displayBanner }"
:style="{ backgroundColor: $themePalette.red.v_100, display: displayBanner }"
>
<h1 style="display: none">
{{ $tr('insufficientStorageHeader') }}
Expand Down
6 changes: 3 additions & 3 deletions kolibri/plugins/coach/assets/src/views/common/QuizStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@
cancelStyleOverrides() {
return {
color: this.$themeTokens.textInverted,
'background-color': this.$themePalette.red.v_1100,
'background-color': this.$themePalette.red.v_300,
// We need to use a darker color for hover than
// palette.red.v_1100 but at the same time,
// palette.red.v_1100 is the darkest available red
// palette.red.v_300 but at the same time,
// palette.red.v_300 is the darkest available red
// in the palette. Using this hardcoded color was
// agreed with designers.
':hover': { 'background-color': '#A81700' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<KIcon
ref="warning"
icon="warning"
:color="$themePalette.yellow.v_1100"
:color="$themePalette.yellow.v_600"
/>
<KTooltip
reference="warning"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div
class="bar-wrapper"
:style="{ backgroundColor: $themePalette.grey.v_200 }"
:style="{ backgroundColor: $themePalette.grey.v_300 }"
>
<div
class="bar help"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>

<table>
<tr :style="{ color: $themePalette.grey.v_600 }">
<tr :style="{ color: $themePalette.grey.v_700 }">
<th>scenario</th>
<th>example tally</th>
<th>status bar</th>
Expand Down Expand Up @@ -243,7 +243,7 @@
return { border: `1px solid ${this.$themeTokens.fineLine}` };
},
thickBorderStyle() {
return { border: `2px solid ${this.$themePalette.grey.v_600}` };
return { border: `2px solid ${this.$themePalette.grey.v_700}` };
},
},
mounted() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
themeClass() {
return this.$computedClass({
':hover': {
backgroundColor: this.$themePalette.grey.v_100,
backgroundColor: this.$themePalette.grey.v_200,
// Add equal and opposite margin and padding to give the highlighted
// region more space without increasing the size of the parent div.
margin: '-8px',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<!-- TODO This question mark thing should probably be an SVG for improved a11y -->
<div
class="question-mark-layout"
:style="{ backgroundColor: $themeBrand.secondary.v_200 }"
:style="{ backgroundColor: $themeBrand.secondary.v_100 }"
>
<span
class="help-icon-style"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<div
v-show="isExpanded(index)"
:style="{
backgroundColor: $themePalette.grey.v_100,
backgroundColor: $themePalette.grey.v_200,
}"
>
<ul class="question-list">
Expand Down Expand Up @@ -140,7 +140,7 @@
<p v-else>
<KIcon
icon="warning"
:style="{ fill: $themePalette.yellow.v_1100 }"
:style="{ fill: $themePalette.yellow.v_600 }"
/>
{{ resourceMissingText }}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
padding: '1em',
marginTop: '2em',
marginBottom: '2em',
backgroundColor: $themePalette.grey.v_100,
backgroundColor: $themePalette.grey.v_200,
position: 'sticky',
insetBlockStart: '0',
zIndex: '4',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
},
activeSectionStyles() {
return {
backgroundColor: this.$themePalette.grey.v_50,
backgroundColor: this.$themePalette.grey.v_100,
border: `1px solid ${this.$themeTokens.fineLine}`,
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<p>
<KIcon
icon="warning"
:style="{ fill: $themePalette.yellow.v_1100 }"
:style="{ fill: $themePalette.yellow.v_600 }"
/>
{{ resourceMissingText }}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
!getCachedResource(resource.contentnode_id).available
"
icon="warning"
:style="{ fill: $themePalette.yellow.v_1100 }"
:style="{ fill: $themePalette.yellow.v_600 }"
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<KIcon
icon="warning"
class="icon"
:color="$themePalette.yellow.v_1100"
:color="$themePalette.yellow.v_600"
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
...mapGetters('deviceInfo', ['isRemoteContent']),
InfoDescriptionColor() {
return {
color: this.$themePalette.grey.v_600,
color: this.$themePalette.grey.v_700,
};
},
pageTitle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
v-for="(task, idx) in activeFacilityTasks"
:key="idx"
class="task-panel"
:style="{ borderBottomColor: $themePalette.grey.v_200 }"
:style="{ borderBottomColor: $themePalette.grey.v_300 }"
:task="task"
@cancel="cancel(task)"
@clear="clear(task)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
v-else
icon="channel"
class="thumbnail-svg"
:style="{ backgroundColor: $themePalette.grey.v_200 }"
:style="{ backgroundColor: $themePalette.grey.v_300 }"
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
:task="task"
class="task-panel"
:appBarTitle="$tr('appBarTitle')"
:style="{ borderBottomColor: $themePalette.grey.v_200 }"
:style="{ borderBottomColor: $themePalette.grey.v_300 }"
@clickclear="handleClickClear(task)"
@clickcancel="handleClickCancel(task)"
@update-title="updateAppBarTitle"
Expand Down
Loading

0 comments on commit 826a1f1

Please sign in to comment.