Skip to content

Commit 66f725c

Browse files
committed
Component: Glass-button: Modify icons library to prevent alignment issues
Signed-off-by: Arturo Manzoli <arturomanzoli@gmail.com>
1 parent c392c95 commit 66f725c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/components/GlassButton.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,10 @@
1919
{{ tooltip }}
2020
</v-tooltip>
2121
</template>
22-
<v-icon v-if="isRound || isUncontained" :size="iconSize" :class="iconClass" class="ml-[4%] mt-[4%]">
23-
{{ icon }}
24-
</v-icon>
25-
<div v-else class="flex items-center justify-center w-full h-full">
26-
<v-icon :size="iconSize" class="mr-2" :class="iconClass">
27-
{{ icon }}
28-
</v-icon>
29-
<div class="text-white ml-2" :class="labelClass">
22+
<Icon v-if="isRound || isUncontained" :icon="icon || ''" :width="iconSize" :class="iconClass" class="-mr-[1px]" />
23+
<div v-else class="flex items-center align-center justify-center w-full h-full">
24+
<Icon :icon="icon || ''" :width="iconSize" :class="iconClass" />
25+
<div class="text-white" :class="labelClass">
3026
{{ label }}
3127
</div>
3228
</div>
@@ -42,6 +38,7 @@
4238
</template>
4339

4440
<script setup lang="ts">
41+
import { Icon, IconifyIcon } from '@iconify/vue'
4542
import { computed } from 'vue'
4643
4744
const props = defineProps<{
@@ -56,7 +53,7 @@ const props = defineProps<{
5653
/**
5754
* The icon to display in the button (prepend on rectangular, centered on round).
5855
*/
59-
icon?: string
56+
icon?: string | IconifyIcon
6057
/**
6158
* Additional Tailwind classes for the icon.
6259
*/
@@ -102,7 +99,8 @@ const tooltip = computed(() => props.tooltip)
10299
const selected = computed(() => props.selected)
103100
const isRound = computed(() => props.variant === 'round')
104101
const isUncontained = computed(() => props.variant === 'uncontained')
105-
const iconSize = computed(() => (isRound.value ? (props.width || 26) * 0.6 : props.iconSize))
102+
const iconSize = computed(() => (isRound.value ? (props.width || 26) * 0.666 : props.iconSize))
103+
const iconClass = computed(() => props.iconClass)
106104
107105
const buttonStyle = computed(() => ({
108106
width: props.width || 40,

0 commit comments

Comments
 (0)