Skip to content

Commit

Permalink
fix(NcCheckboxRadioSwitch): Fix contrast of Radio switches using butt…
Browse files Browse the repository at this point in the history
…on-variant

Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Nov 9, 2023
1 parent bc6f8b9 commit 8e8cb8e
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,

Check failure on line 32 in src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected indentation of 4 tabs but found 3 tabs
'checkbox-content__icon--checked': isChecked,

Check failure on line 33 in src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected indentation of 4 tabs but found 3 tabs
[iconClass]: true

Check failure on line 34 in src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected indentation of 4 tabs but found 3 tabs
}"

Check failure on line 35 in src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected indentation of 3 tabs but found 2 tabs
: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 8e8cb8e

Please sign in to comment.