Last active
February 10, 2022 13:12
-
-
Save sagalbot/75a85fb8f57d713653df9aaa4bdacd5c to your computer and use it in GitHub Desktop.
Super lightweight implementation of @primer/octicons as a Vue component. ex) `<icon name="alert" />`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import icons from '@pimer/octicons'; | |
export default { | |
functional: true, | |
render(createElement, { props }) { | |
return Object.hasOwnProperty.apply(icons, [props.name]) ? createElement('svg', { | |
domProps: { innerHTML: icons[props.name].path }, | |
attrs: { ...icons[props.name].options }, | |
}) : false; | |
}, | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment