aboutsummaryrefslogtreecommitdiff
path: root/src/components/IconButton.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-07-04 21:19:11 +1000
committerTerry Truong <terry06890@gmail.com>2022-07-04 21:38:13 +1000
commit9e8e30c5c680ca81862e4fba5f7ae9ecea62b8ff (patch)
treedfff71771a8896b68b273b8cc073f128e3d20203 /src/components/IconButton.vue
parent6adc1e2696ec997c2e6b74043e06cfd87c6486c1 (diff)
Update IconButton to maintain equal width/height
Diffstat (limited to 'src/components/IconButton.vue')
-rw-r--r--src/components/IconButton.vue16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/components/IconButton.vue b/src/components/IconButton.vue
index 0294c5b..5684fb0 100644
--- a/src/components/IconButton.vue
+++ b/src/components/IconButton.vue
@@ -1,7 +1,6 @@
<template>
-<div class="p-2 rounded-full hover:cursor-pointer"
- :class="{'hover:brightness-125': !disabled, 'brightness-50': disabled}"
- :style="{width: size + 'px', height: size + 'px', padding: (size / 5) + 'px'}">
+<div :style="styles" class="p-2 rounded-full hover:cursor-pointer"
+ :class="{'hover:brightness-125': !disabled, 'brightness-50': disabled}">
<slot class="w-full h-full">?</slot>
</div>
</template>
@@ -14,5 +13,16 @@ export default defineComponent({
size: {type: Number, default: 36},
disabled: {type: Boolean, default: false},
},
+ computed: {
+ styles(): Record<string,string> {
+ return {
+ minWidth: this.size + 'px',
+ maxWidth: this.size + 'px',
+ minHeight: this.size + 'px',
+ maxHeight: this.size + 'px',
+ padding: (this.size / 5) + 'px',
+ };
+ },
+ },
});
</script>