Skip to content

Commit

Permalink
better checkbox handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nucleogenesis committed Nov 1, 2024
1 parent fbcff2d commit e0d300c
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
:key="'cat-' + key"
appearance="flat-button"
class="category-button"
:class="$computedClass({ ':hover': { background: selectedHighlightColor } })"
:style="{
background: isCategoryActive(category.value) ? selectedHighlightColor : '',
':hover': {
background: 'orange!important',
},
}"
:text="coreString(category.value)"
:disabled="
Expand Down Expand Up @@ -63,8 +67,8 @@
<KCheckbox
v-for="lang in languageOptionsList"
:key="'lang-' + lang.value"
:checked="isSelected('languages', lang)"
:disabled="lang.disabled"
:checked="isChecked('languages', lang)"
:disabled="lang.disabled || isEnabledButNotSelected('languages', lang)"
:label="lang.label"
@change="handleChange('languages', lang)"
/>
Expand All @@ -88,8 +92,8 @@
<KCheckbox
v-for="level in contentLevelsList"
:key="'level-' + level.value"
:checked="isSelected('grade_levels', level)"
:disabled="level.disabled"
:checked="isChecked('grade_levels', level)"
:disabled="level.disabled || isEnabledButNotSelected('grade_levels', level)"
:label="level.label"
@change="handleChange('grade_levels', level)"
/>
Expand Down Expand Up @@ -140,8 +144,8 @@
<KCheckbox
v-for="a11y in accessibilityOptionsList"
:key="'a11y-' + a11y.value"
:checked="isSelected('accessibility_labels', a11y)"
:disabled="a11y.disabled"
:checked="isChecked('accessibility_labels', a11y)"
:disabled="a11y.disabled || isEnabledButNotSelected('accessibility_labels', a11y)"
:label="a11y.label"
@change="handleChange('accessibility_labels', a11y)"
/>
Expand Down Expand Up @@ -213,7 +217,7 @@
computed: {
selectedHighlightColor() {
// get right color
return this.$themePalette.blue.v_200;
return '#D9E1FD';
},
availableRootCategories() {
if (this.searchableLabels) {
Expand Down Expand Up @@ -324,9 +328,15 @@
},
},
methods: {
isChecked(inputKey, value) {
return this.isSelected(inputKey, value) || this.isEnabledButNotSelected(inputKey, value);
},
isSelected(inputKey, value) {
return this.value[inputKey][value.value] === true;
},
isEnabledButNotSelected(inputKey, value) {
return (
this.value[inputKey][value.value] === true ||
!this.isSelected(inputKey, value) &&
{
languages: this.enabledLanguageOptions,
channels: this.enabledChannelOptions,
Expand Down

0 comments on commit e0d300c

Please sign in to comment.