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
796 B
Vue
Raw Normal View History

2020-07-22 13:19:23 -07:00
<template>
2021-06-15 03:57:50 -07:00
<img v-if="icon.endsWith('.svg')" :src="`/img/${icon}`" :style="`height: ${size}em; width: ${size}em; display: inline;`" alt="" class="icon"/>
2021-04-06 06:15:59 -07:00
<span v-else :class="['fa' + iconSet, 'fa-' + icon, 'fa-fw']" :style="`font-size: ${size}em`"></span>
2020-07-22 13:19:23 -07:00
</template>
<script>
export default {
props: {
v: { required: true },
2020-07-26 07:41:46 -07:00
set: { default: 'l' },
2020-09-25 03:17:02 -07:00
size: { default: 1 },
2021-04-06 06:15:59 -07:00
},
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;
},
},
2020-07-22 13:19:23 -07:00
}
</script>