chore: button styles
This commit is contained in:
@@ -7,20 +7,20 @@
|
|||||||
@click="handleClick"
|
@click="handleClick"
|
||||||
>
|
>
|
||||||
<fluent-icon
|
<fluent-icon
|
||||||
v-if="icon"
|
v-if="icon && !iconOnly"
|
||||||
:size="iconSize"
|
:size="iconSize"
|
||||||
:icon="icon"
|
:icon="icon"
|
||||||
class="flex-shrink-0"
|
class="flex-shrink-0"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-if="$slots.default"
|
v-if="$slots.default && !iconOnly"
|
||||||
class="text-sm font-medium truncate"
|
class="text-sm font-medium truncate"
|
||||||
:class="{ 'text-left rtl:text-right': size !== 'expanded' }"
|
:class="{ 'text-left rtl:text-right': size !== 'expanded' }"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</span>
|
</span>
|
||||||
<fluent-icon
|
<fluent-icon
|
||||||
v-if="rightIcon"
|
v-if="rightIcon || iconOnly"
|
||||||
:size="iconSize"
|
:size="iconSize"
|
||||||
icon="chevron-right"
|
icon="chevron-right"
|
||||||
class="flex-shrink-0"
|
class="flex-shrink-0"
|
||||||
@@ -46,10 +46,6 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
emoji: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
colorScheme: {
|
colorScheme: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'primary',
|
default: 'primary',
|
||||||
@@ -74,14 +70,27 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
iconOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
buttonClasses() {
|
buttonClasses() {
|
||||||
return [this.colorClass, this.sizeClass];
|
return [this.colorClass, this.sizeClass];
|
||||||
},
|
},
|
||||||
colorClass() {
|
colorClass() {
|
||||||
|
if (this.isDisabled) {
|
||||||
|
return 'bg-ash-200 text-ash-600 cursor-not-allowed';
|
||||||
|
}
|
||||||
if (this.colorScheme === 'primary') {
|
if (this.colorScheme === 'primary') {
|
||||||
return 'bg-primary-600 text-white hover:bg-primary-700 active:bg-primary-700 focus:ring focus:ring-offset-1 focus:ring-primary-400';
|
if (this.variant === 'outline') {
|
||||||
|
return 'text-primary-800 border border-primary-400 hover:text-primary-600 active:text-primary-600 focus:ring focus:ring-offset-1 focus:ring-primary-400';
|
||||||
|
}
|
||||||
|
if (this.variant === 'ghost') {
|
||||||
|
return 'text-primary-800 hover:text-primary-600 active:text-primary-600 focus:ring focus:ring-offset-1 focus:ring-primary-400';
|
||||||
|
}
|
||||||
|
return 'bg-primary-600 border-primary-600 text-white hover:bg-primary-700 active:bg-primary-700 focus:ring focus:ring-offset-1 focus:ring-primary-400';
|
||||||
}
|
}
|
||||||
if (this.colorScheme === 'secondary') {
|
if (this.colorScheme === 'secondary') {
|
||||||
return 'bg-ash-100 text-ash-900 hover:bg-ash-200 active:bg-ash-200 focus:ring focus:ring-offset-1 focus:ring-ash-400';
|
return 'bg-ash-100 text-ash-900 hover:bg-ash-200 active:bg-ash-200 focus:ring focus:ring-offset-1 focus:ring-ash-400';
|
||||||
@@ -92,17 +101,13 @@ export default {
|
|||||||
return 'bg-primary-500 text-white';
|
return 'bg-primary-500 text-white';
|
||||||
},
|
},
|
||||||
sizeClass() {
|
sizeClass() {
|
||||||
if (this.size === 'md') {
|
if (this.size === 'medium') {
|
||||||
return 'px-3 py-2 text-sm';
|
return 'px-3 py-2 text-sm';
|
||||||
}
|
}
|
||||||
return 'px-4 py-2.5 text';
|
return 'px-4 py-2.5 text';
|
||||||
},
|
},
|
||||||
iconSize() {
|
iconSize() {
|
||||||
switch (this.size) {
|
switch (this.size) {
|
||||||
case 'tiny':
|
|
||||||
return 12;
|
|
||||||
case 'small':
|
|
||||||
return 14;
|
|
||||||
case 'medium':
|
case 'medium':
|
||||||
return 16;
|
return 16;
|
||||||
case 'large':
|
case 'large':
|
||||||
|
|||||||
Reference in New Issue
Block a user