Skip to content

Commit

Permalink
fix: by comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilfrontend committed May 16, 2022
1 parent 3957900 commit 2f11b8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/qComponents/QButton/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ export type {
QButtonPropDisabled,
QButtonPropAutofocus,
QButtonPropCircle,
QButtonPropFullWidth,
QButtonInstance
QButtonPropFullWidth
} from './src/types';
18 changes: 11 additions & 7 deletions src/qComponents/QButton/src/QButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class="q-icon-reverse"
/>
<span
v-if="icon && !isLoading"
v-else-if="icon"
:class="icon"
/>
<span
Expand Down Expand Up @@ -46,6 +46,10 @@ import type {
QButtonInstance
} from './types';
const defaultPropTypeValue = 'default';
const defaultPropThemeValue = 'primary';
const defaultPropSizeValue = 'medium';
export default /* #__PURE__ */ defineComponent({
name: 'QButton',
Expand All @@ -54,13 +58,13 @@ export default /* #__PURE__ */ defineComponent({
props: {
type: {
type: String as PropType<QButtonPropType>,
default: 'default',
default: defaultPropTypeValue,
validator: validateArray<QButtonPropType>(['default', 'icon'])
},
theme: {
type: String as PropType<QButtonPropTheme>,
default: 'primary',
default: defaultPropThemeValue,
validator: validateArray<QButtonPropTheme>([
'primary',
'secondary',
Expand All @@ -70,7 +74,7 @@ export default /* #__PURE__ */ defineComponent({
size: {
type: String as PropType<QButtonPropSize>,
default: 'medium',
default: defaultPropSizeValue,
validator: validateArray<QButtonPropSize>(['small', 'medium'])
},
Expand Down Expand Up @@ -147,9 +151,9 @@ export default /* #__PURE__ */ defineComponent({
const classList = computed<ClassValue[]>(() => {
const classes: ClassValue[] = Object.entries({
theme: props.theme,
type: props.type,
size: props.size
theme: props.theme ?? defaultPropThemeValue,
type: props.type ?? defaultPropTypeValue,
size: props.size ?? defaultPropSizeValue
})
.filter(([, value]) => Boolean(value))
.map(([key, value]) => `q-button_${key}_${value}`);
Expand Down

0 comments on commit 2f11b8f

Please sign in to comment.