Skip to content

Commit

Permalink
changed siblings to same property
Browse files Browse the repository at this point in the history
  • Loading branch information
rationality6 committed May 1, 2020
1 parent 21b8571 commit e67c964
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions packages/kolibri-components/src/KRadioButton.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<template>

<!-- HTML makes clicking label apply to input by default -->
<label
:class="['k-radio-button', { disabled }]"
:style="{ color: disabled ? $themeTokens.textDisabled : '' }"
>
<label :class="['k-radio-button', { disabled }]" :style="{ color: disabled ? $themeTokens.textDisabled : '' }">
<!-- v-model listens for @input event by default -->
<!-- @input has compatibility issues for input of type radio -->
<!-- Here, manually listen for @change (no compatibility issues) -->
Expand All @@ -23,29 +20,13 @@
@keydown="$emit('keydown', $event)"
>
<!-- the radio buttons the user sees -->
<mat-svg
v-if="isChecked"
category="toggle"
name="radio_button_checked"
class="checked"
:style="[{ fill: $themeTokens.primary }, disabledStyle, activeStyle ]"
/>
<mat-svg
v-else
category="toggle"
name="radio_button_unchecked"
class="unchecked"
:style="[{ fill: $themeTokens.annotation }, disabledStyle, activeStyle ]"
/>
<mat-svg v-if="isChecked" category="toggle" name="radio_button_checked" class="checked" :style="[{ fill: $themeTokens.primary }, disabledStyle, activeStyle ]" />
<mat-svg v-else category="toggle" name="radio_button_unchecked" class="unchecked" :style="[{ fill: $themeTokens.annotation }, disabledStyle, activeStyle ]" />

<span class="text" dir="auto">
<span class="truncate-text">{{ label }}</span>

<span
v-if="description"
class="description"
:style="[{ color: disabled ? '' : $themeTokens.annotation }, disabledStyle ]"
>
<span v-if="description" class="description" :style="[{ color: disabled ? '' : $themeTokens.annotation }, disabledStyle ]">
{{ description }}
</span>
<slot></slot>
Expand Down Expand Up @@ -125,7 +106,11 @@
return this.active ? this.$coreOutline : {};
},
disabledStyle() {
return this.disabled ? { fill: this.$themeTokens.textDisabled } : {};
return this.disabled
? {
fill: this.$themeTokens.textDisabled,
}
: {};
},
},
Expand Down Expand Up @@ -189,8 +174,8 @@
height: $radio-height;
}
.text,
.description {
.description,
.text {
display: inline-block;
}
.text {
Expand All @@ -204,7 +189,8 @@
line-height: normal;
}
.truncate-text {
display: block;
display: inline-block;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
Expand Down

0 comments on commit e67c964

Please sign in to comment.