Ensure unit of the size prop in the icon component

This commit is contained in:
2026-05-23 16:30:43 +02:00
parent 0566261ef5
commit 91a6f6d848
+4 -1
View File
@@ -16,6 +16,7 @@ limitations under the License.
<script setup> <script setup>
import { computed } from 'vue'; import { computed } from 'vue';
import { ensureUnit } from '@/utils/cssDimensions';
const props = defineProps({ const props = defineProps({
name: { name: {
@@ -34,8 +35,10 @@ const icons = import.meta.glob('@/assets/icons/*.svg', {
}) })
const Icon = computed(() => icons[`/src/assets/icons/${props.name}.svg`]) const Icon = computed(() => icons[`/src/assets/icons/${props.name}.svg`])
const size = computed(() => ensureUnit(props.size))
</script> </script>
<template> <template>
<img :src="Icon" :style="{ height: `${props.size}px`, width: `${props.size}px` }" /> <img :src="Icon" :style="{ height: `${size}`, width: `${size}` }" />
</template> </template>