2
0
mirror of https://github.com/frappe/books.git synced 2025-02-05 21:48:32 +00:00
books/src/components/FeatherIcon.vue
2022-05-23 16:18:22 +05:30

35 lines
709 B
Vue

<script>
import feather from 'feather-icons';
import { h } from 'vue';
const validIcons = Object.keys(feather.icons);
export default {
props: {
name: {
type: String,
required: true,
validator: (value) => validIcons.includes(value),
},
},
render() {
const icon = feather.icons[this.name];
const svg = h('svg', {
...Object.assign({}, icon.attrs, {
fill: 'none',
stroke: 'currentColor',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 1.5,
width: null,
height: null,
}),
class: [icon.attrs.class],
innerHTML: icon.contents,
});
return svg;
},
};
</script>