This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/components/Icon.vue

26 lines
783 B
Vue

<template>
<img v-if="icon.endsWith('.svg')" :src="`/img/${icon}`" :style="`height: ${size}em; width: ${size}em; display: inline;`" alt=""/>
<span v-else :class="['fa' + iconSet, 'fa-' + icon, 'fa-fw']" :style="`font-size: ${size}em`"></span>
</template>
<script>
export default {
props: {
v: { required: true },
set: { default: 'l' },
size: { default: 1 },
},
computed: {
valueParts() {
return this.v.split(':');
},
icon() {
return this.valueParts[this.valueParts.length - 1];
},
iconSet() {
return this.valueParts.length > 1 ? this.valueParts[0] : this.set;
},
},
}
</script>