Skip to content

Commit

Permalink
Merge pull request #4791 from nextcloud-libraries/bugfix/4785/tab-hea…
Browse files Browse the repository at this point in the history
…ders-and-checkboxes-contrast

fix(NcCheckboxRadioSwitch): Fix contrast of Radio switches using butt…
  • Loading branch information
nickvergessen committed Nov 9, 2023
2 parents 83e17ff + f261b94 commit 9a7aa31
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
29 changes: 26 additions & 3 deletions src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@
<template>
<component :is="wrapperElement"
:for="!isButtonType ? id : null"
class="checkbox-content">
<span :class="['checkbox-content__icon', iconClass]"
class="checkbox-content"
:class="{
['checkbox-content-' + type]: true,
'checkbox-content--button-variant': buttonVariant,
}">
<span :class="{
'checkbox-content__icon': true,
'checkbox-content__icon--checked': isChecked,
[iconClass]: true
}"
:aria-hidden="true">
<!-- @slot The checkbox/radio icon, you can use it for adding an icon to the button variant
@binding {bool} checked The input checked state
Expand Down Expand Up @@ -222,11 +230,26 @@ export default {
}
&__icon > * {
color: var(--color-primary-element);
width: var(--icon-size);
height: var(--icon-size);
}
&--button-variant {
.checkbox-content__icon:not(.checkbox-content__icon--checked) > * {
color: var(--color-primary-element);
}
.checkbox-content__icon--checked > * {
color: var(--color-primary-element-text);
}
}
&:not(&--button-variant) {
.checkbox-content__icon > * {
color: var(--color-primary-element);
}
}
&, * {
cursor: pointer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ export default {
&--checked:not(&--disabled):focus-within &__content,
&--checked:not(&--disabled) &__content:hover {
background-color: var(--color-primary-element-hover);
}
&--checked:not(&--button-variant):not(&--disabled):focus-within &__content,
&--checked:not(&--button-variant):not(&--disabled) &__content:hover {
background-color: var(--color-primary-element-light-hover);
}
Expand All @@ -666,7 +671,8 @@ export default {
font-weight: bold;
.checkbox-radio-switch__content {
background-color: var(--color-primary-element-light);
background-color: var(--color-primary-element);
color: var(--color-primary-element-text);
}
}
}
Expand Down

0 comments on commit 9a7aa31

Please sign in to comment.