Skip to content

fix(NcCheckboxRadioSwitch): Fix contrast of Radio switches using butt… #4791

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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