2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 19:29:02 +00:00
books/ui/components/FeatherIcon.vue

47 lines
984 B
Vue
Raw Normal View History

2018-06-27 14:38:27 +00:00
<template>
<div class="feather-icon" v-html="iconSVG"></div>
</template>
<script>
import feather from 'feather-icons';
const validIcons = Object.keys(feather.icons);
export default {
props: {
name: {
type: String,
required: true,
validator(value) {
const valid = validIcons.includes(value);
if (!valid) {
console.warn(`name property for feather-icon must be one of `, validIcons);
}
return valid;
}
},
size: {
type: Number,
default: 16
}
},
computed: {
iconSVG() {
const icon = feather.icons[this.name];
if (!icon) {
return '';
}
return icon.toSvg({
width: this.size,
height: this.size
});
2018-06-27 14:38:27 +00:00
}
}
}
</script>
<style>
.feather-icon {
2018-10-15 12:08:07 +00:00
display: inline-flex;
2018-06-27 14:38:27 +00:00
}
</style>