ultrawidify/src/common/components/Icon.vue

34 lines
758 B
Vue
Raw Normal View History

2020-12-02 22:39:43 +01:00
<template>
2020-12-07 00:07:59 +01:00
<svg class="bi icon" width="1em" height="1em" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2020-12-02 22:39:43 +01:00
<use :xlink:href=" '' + iconHref" />
</svg>
</template>
<script>
2020-12-06 21:57:16 +01:00
import BrowserDetect from '../../ext/conf/BrowserDetect';
2020-12-02 22:39:43 +01:00
export default {
props: {
icon: String,
},
data() {
2020-12-06 21:57:16 +01:00
// note — webextension-polyfill is not gonna save us here.
// been there, tried that.
2020-12-02 22:39:43 +01:00
return {
2020-12-06 21:57:16 +01:00
bootstrapIconsBasePath: (BrowserDetect.firefox ? browser : chrome).runtime.getURL('/res/icons/bootstrap-icons.svg'),
2020-12-02 22:39:43 +01:00
iconHref: '',
};
},
created() {
this.iconHref = `${this.bootstrapIconsBasePath}#${this.icon}`;
}
}
</script>
<style scoped>
2020-12-03 00:32:17 +01:00
.icon {
2020-12-04 00:53:20 +01:00
margin-left: 0.25em;
margin-right: 0.25em;
2020-12-03 00:32:17 +01:00
}
2020-12-02 22:39:43 +01:00
</style>